public void WidthWillBeSizeOfBackgroundClassPluOneIfDifferentThanImageWidth(int width) { var testable = new TestableSpriteContainer(); var image1 = new BackgroundImageClass("", "http://server/content/style.css") { ImageUrl = "url1", Width = width }; testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url1")).Returns( testable.Image15X17); testable.ClassUnderTest.AddImage(image1); Assert.Equal(width + 1, testable.ClassUnderTest.Width); }
public void WillAutoCorrectHeightIfHeightAndOffsetAreGreaterThanOriginal() { var testable = new TestableSpriteContainer(); var image1 = new BackgroundImageClass("", "http://server/content/style.css") { ImageUrl = "url1", Height = 10, YOffset = new Position() { PositionMode = PositionMode.Unit, Offset = -10 } }; testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url1")).Returns( testable.Image15X17); testable.ClassUnderTest.AddImage(image1); Assert.Equal(10, testable.ClassUnderTest.Height); }
public void WillAutoCorrectWidthIfWidthAndOffsetAreGreaterThanOriginal() { var testable = new TestableSpriteContainer(); var image1 = new BackgroundImageClass("", 0) { ImageUrl = "url1", ExplicitWidth = 10, XOffset = new Position() { PositionMode = PositionMode.Unit, Offset = -10 } }; testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url1")).Returns( testable.Image15X17); testable.ClassUnderTest.AddImage(image1); Assert.Equal(11, testable.ClassUnderTest.Width); }
public void SizeWillBeAggregateOfAddedImages() { var testable = new TestableSpriteContainer(); var image1 = new BackgroundImageClass("", "http://server/content/style.css") { ImageUrl = "url1" }; var image2 = new BackgroundImageClass("", "http://server/content/style.css") { ImageUrl = "url2" }; testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url1")).Returns( testable.Image15X17); testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url2")).Returns( testable.Image18X18); testable.ClassUnderTest.AddImage(image1); testable.ClassUnderTest.AddImage(image2); Assert.Equal(testable.Image15X17.Length + testable.Image18X18.Length, testable.ClassUnderTest.Size); }
public void HeightWillBeTheTallestOfAddedImages() { var testable = new TestableSpriteContainer(); var image1 = new BackgroundImageClass("", 0) { ImageUrl = "url1" }; var image2 = new BackgroundImageClass("", 0) { ImageUrl = "url2" }; testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url1")).Returns( testable.Image15X17); testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url2")).Returns( testable.Image18X18); testable.ClassUnderTest.AddImage(image1); testable.ClassUnderTest.AddImage(image2); Assert.Equal(18, testable.ClassUnderTest.Height); }
public void WidthWillBeAggregateOfAddedImageWidthsPlusOnePixelEach() { var testable = new TestableSpriteContainer(); var image1 = new BackgroundImageClass("", 0) { ImageUrl = "url1" }; var image2 = new BackgroundImageClass("", 0) { ImageUrl = "url2" }; testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url1")).Returns( testable.Image15X17); testable.Mock <IWebClientWrapper>().Setup(Xunit => Xunit.DownloadBytes("url2")).Returns( testable.Image18X18); testable.ClassUnderTest.AddImage(image1); testable.ClassUnderTest.AddImage(image2); Assert.Equal(35, testable.ClassUnderTest.Width); }