using System; using Blacklight.Core; using Glass; using Prism; using UnitTestSharp; namespace Konis.Testbed.UnitTests { public class GradientBarTests : TestFixture { public class CtorTests : TestFixture { public void WithoutAWindow_Throws() { CheckThrow(typeof(ArgumentNullException)); new GradientBar(null, 16); } public void MakesATextureAsWideAsTheBarAndOnePixelTall() { var bar = new GradientBar(new NullWindowHandle(), 16); var texture = ((TextureMaterial)bar.Material).Texture; CheckEqual(16, texture.Size.X); CheckEqual(1, texture.Size.Y); } } public class UploadTests : TestFixture { public void PixelsOfTheWrongSize_Throw() { var bar = new GradientBar(new NullWindowHandle(), 16); CheckThrow(typeof(ArgumentException)); bar.Upload(new byte[3]); } public void PixelsOfTheBarsSize_AreAccepted() { var bar = new GradientBar(new NullWindowHandle(), 16); bar.Upload(new byte[16 * 4]); } } public class ShowTests : TestFixture { public void AGradient_IsDrawnAndUploaded() { var bar = new GradientBar(new NullWindowHandle(), 16); bar.Show(Gradient.Between(Colors.Black, Colors.White)); } public void NoGradient_Throws() { var bar = new GradientBar(new NullWindowHandle(), 16); CheckThrow(typeof(ArgumentNullException)); bar.Show(null); } } } }