#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; using Nuclex.UserInterface.Controls; namespace Nuclex.UserInterface.Visuals.Flat.Renderers { /// Unit Test for the flat progress bar control renderer [TestFixture] internal class FlatProgressControlRendererTest : ControlRendererTest { /// Called before each test is run [SetUp] public override void Setup() { base.Setup(); this.progress = new ProgressControl(); this.progress.Progress = 0.5f; this.progress.Bounds = new UniRectangle(10, 10, 100, 100); Screen.Desktop.Children.Add(this.progress); this.renderer = new FlatProgressControlRenderer(); } /// Verifies that the renderer is able to render the progress bar [Test] public void TestRenderNormal() { // Make sure the renderer draws at least two frames MockedGraphics.Expects.AtLeast(2).Method( m => m.DrawElement(null, RectangleF.Empty) ).WithAnyArguments(); // Let the renderer draw the progress bar into the mocked graphics interface renderer.Render(this.progress, MockedGraphics.MockObject); // And verify the expected drawing commands were issues Mockery.VerifyAllExpectationsHaveBeenMet(); } /// Progress bar renderer being tested private FlatProgressControlRenderer renderer; /// Progress bar used to test the progress bar renderer private ProgressControl progress; } } // namespace Nuclex.UserInterface.Visuals.Flat.Renderers #endif // UNITTEST