#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2010 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
#if UNITTEST
using System;
using System.Runtime.InteropServices;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using NUnit.Framework;
using NMock;
namespace Nuclex.UserInterface.Visuals.Flat.Renderers {
/// Base class for control renderer unit tests
public abstract class ControlRendererTest {
/// Called before each test is run
[SetUp]
public virtual void Setup() {
this.mockery = new MockFactory();
this.mockedGraphics = this.mockery.CreateMock();
this.screen = new Screen(800, 600);
}
/// Called after each test is run
[TearDown]
public virtual void TearDown() {
if(this.mockery != null) {
this.screen = null;
this.mockedGraphics = null;
this.mockery.Dispose();
this.mockery = null;
}
}
/// Mockery used to create the mocked graphics interface
protected MockFactory Mockery {
get { return this.mockery; }
}
/// Mocked graphics interface the GUI can be tested on
protected Mock MockedGraphics {
get { return this.mockedGraphics; }
}
/// Screen the controls can be placed on for testing
protected Screen Screen {
get { return this.screen; }
}
/// Screen the tested control can be placed on
private Screen screen;
/// Graphics interface used for rendering the GUI
private Mock mockedGraphics;
/// Mockery used to create the mocked graphics interface
private MockFactory mockery;
}
} // namespace Nuclex.UserInterface.Visuals.Flat.Renderers
#endif // UNITTEST