Exemplo n.º 1
0
            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);
            }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
            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);
            }
Exemplo n.º 4
0
            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);
            }
Exemplo n.º 5
0
            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);
            }
Exemplo n.º 6
0
            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);
            }