Example #1
0
            public void UniqueColorsOfAddedImagesWillBe0WhenNotInFullTrust()
            {
                var testable       = new TestableSpriteContainer();
                var fiveColorImage = new BackgroundImageClass("image1", "")
                {
                    ImageUrl = "url"
                };

                testable.Mock <IWebClientWrapper>().Setup(x => x.DownloadBytes("url")).Returns(TestableSpriteContainer.GetFiveColorImage());
                var fourColorImage = new BackgroundImageClass("image2", "")
                {
                    ImageUrl = "url2"
                };

                testable.Mock <IWebClientWrapper>().Setup(x => x.DownloadBytes("url2")).Returns(TestableSpriteContainer.GetFourColorImage());
                testable.Mock <IRRConfiguration>().Setup(x => x.IsFullTrust).Returns(false);

                testable.ClassUnderTest.AddImage(fiveColorImage);
                testable.ClassUnderTest.AddImage(fourColorImage);

                Assert.Equal(0, testable.ClassUnderTest.Colors);
            }
Example #2
0
            public void WillCountUniqueColorsOfAddedImages()
            {
                var testable       = new TestableSpriteContainer();
                var fiveColorImage = new BackgroundImageClass("image1", "")
                {
                    ImageUrl = "url"
                };

                testable.Mock <IWebClientWrapper>().Setup(x => x.DownloadBytes("url")).Returns(TestableSpriteContainer.GetFiveColorImage());
                var fourColorImage = new BackgroundImageClass("image2", "")
                {
                    ImageUrl = "url2"
                };

                testable.Mock <IWebClientWrapper>().Setup(x => x.DownloadBytes("url2")).Returns(TestableSpriteContainer.GetFourColorImage());

                testable.ClassUnderTest.AddImage(fiveColorImage);
                testable.ClassUnderTest.AddImage(fourColorImage);

                Assert.Equal(7, testable.ClassUnderTest.Colors);
            }