public static void Y2016_Day12_Process_Returns_Correct_Solution()
        {
            // Arrange
            string[] instructions = new[]
            {
                "cpy 41 a",
                "inc a",
                "inc a",
                "dec a",
                "jnz a 2",
                "dec a",
            };

            int[] binsOfInterest = new[] { 0, 1, 2 };

            // Act
            var actual = Day12.Process(instructions, initialValueOfC: 0);

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(4, actual.Count);
            Assert.Equal(42, actual['a']);
            Assert.Equal(0, actual['b']);
            Assert.Equal(0, actual['c']);
            Assert.Equal(0, actual['d']);
        }
        public GetAzureRmUsageTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsUsageMetricOperationsMock = new Mock<IUsageMetricsOperations>();
            insightsClientMock = new Mock<InsightsClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmUsageCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsClient = insightsClientMock.Object
            };

            response = Utilities.InitializeUsageMetricResponse();

            insightsUsageMetricOperationsMock
                .Setup(f => f.ListAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<UsageMetricListResponse>(response))
                .Callback((string f, string s, string a, CancellationToken t) =>
                {
                    resourceId = f;
                    filter = s;
                    apiVersion = a;
                });

            insightsClientMock
                .SetupGet(f => f.UsageMetricOperations)
                .Returns(this.insightsUsageMetricOperationsMock.Object);
        }
        public GetAzureRmUsageTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            //ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsUsageMetricOperationsMock = new Mock<IUsageMetricsOperations>();
            insightsClientMock = new Mock<InsightsClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmUsageCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsClient = insightsClientMock.Object
            };

            response = new Microsoft.Rest.Azure.AzureOperationResponse<IEnumerable<UsageMetric>>()
            {
                Body = new List<UsageMetric>()
            };

            insightsUsageMetricOperationsMock
                .Setup(f => f.ListWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ODataQuery<UsageMetric>>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<Microsoft.Rest.Azure.AzureOperationResponse<IEnumerable<UsageMetric>>>(response))
                .Callback((string r, string api, ODataQuery<UsageMetric> q, Dictionary<string, List<string>> headers, CancellationToken t) =>
                {
                    resourceId = r;
                    filter = q;
                    apiVersion = api;
                });

            insightsClientMock
                .SetupGet(f => f.UsageMetrics)
                .Returns(this.insightsUsageMetricOperationsMock.Object);
        }
Beispiel #4
0
        public void Should_be_able_to_convert_to_json()
        {
            var obj = new { foo = "bar" };
            var json = obj.ToJson();

            Assert.NotEqual(string.Empty, json);
        }
Beispiel #5
0
 public void NextItemTest()
 {
     Random rnd = new Random();
     int[] array = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     int item = rnd.NextItem(array);
     Assert.Contains(item, array);
 }
Beispiel #6
0
        public void ShouldAccumulateFullTriangle()
        {
            var expectedValues = new[] { "ProductA",
                                            "45.2", "110", "110",  "147",
                                                    "50",  "125",  "150",
                                                           "55",   "140",
                                                                   "100" };

            var triangle = new ClaimTriangle("ProductA", _collector);
            triangle[1990][1990] = 45.2;
            triangle[1990][1991] = 64.8;
            triangle[1990][1993] = 37;
            triangle[1991][1991] = 50;
            triangle[1991][1992] = 75;
            triangle[1991][1993] = 25;
            triangle[1992][1992] = 55;
            triangle[1992][1993] = 85;
            triangle[1993][1993] = 100;

            var actualValues = triangle.Accumulate().Flatten(new TriangleDimensions { OriginYear = 1990, DevelopmentYears = 4 });

            for (int i = 0; i < actualValues.Length; i++)
            {
                Assert.Equal(expectedValues[i], actualValues[i]);
            }
        }
Beispiel #7
0
        public void MeanSquareError_ThrowOnLengthMismatch()
        {
            var target = new[] { 1.0, 1.0 };
            var output = new[] { 1.0 };

            Assert.Throws<NeuralNetworkException>(() => ErrorCalculations.MeanSquareError(target, output));
        }
        public AddAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            //ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock<IAutoscaleSettingsOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new AddAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AzureOperationResponse<AutoscaleSettingResource>()
            {
                Body = new AutoscaleSettingResource()
            };

            insightsAutoscaleOperationsMock.Setup(f => f.CreateOrUpdateWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<AutoscaleSettingResource>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<Microsoft.Rest.Azure.AzureOperationResponse<AutoscaleSettingResource>>(response))
                .Callback((string resourceGrp, string settingNm, AutoscaleSettingResource createOrUpdateParams, Dictionary<string, List<string>> headers, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    settingName = settingNm;
                    createOrUpdatePrms = createOrUpdateParams;
                });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleSettings).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
        public GetAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock<IAutoscaleOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AutoscaleSettingGetResponse()
            {
                RequestId = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
                Id = "",
                Location = "",
                Name = "",
                Properties = null,
                Tags = null,
            };

            responseList = new AutoscaleSettingListResponse()
            {
                RequestId = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
                AutoscaleSettingResourceCollection = new AutoscaleSettingResourceCollection()
                {
                    Value = new List<AutoscaleSettingResource>()
                    {
                        new AutoscaleSettingResource(){
                                Id = "",
                                Location = "",
                                Name = "",
                                Properties = null,
                                Tags = null,
                            },
                    }
                }
            };

            insightsAutoscaleOperationsMock.Setup(f => f.GetSettingAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AutoscaleSettingGetResponse>(response))
                .Callback((string resourceGrp, string settingNm, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    settingName = settingNm;
                });

            insightsAutoscaleOperationsMock.Setup(f => f.ListSettingsAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AutoscaleSettingListResponse>(responseList))
                .Callback((string resourceGrp, string targetResourceId, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    targetResourceUri = targetResourceId;
                });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleOperations).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
Beispiel #10
0
 public void Eliminate_anagram_subsets()
 {
     var detector = new Anagram("good");
     var words = new[] { "dog", "goody" };
     var results = new string[0];
     Assert.Equal(detector.Match(words), results);
 }
Beispiel #11
0
 public void Eliminate_anagrams_with_same_checksum()
 {
     var detector = new Anagram("mass");
     var words = new[] { "last" };
     var results = new string[0];
     Assert.Equal(detector.Match(words), results);
 }
        public void AddQueryListMultipleNullItem()
        {
            var list = new[] { "test1", null, "test3" };
            var url = UrlBuilder.Create("test").AddQuery("name", "value").AddQueryList("test", list).Url;

            Assert.Equal("test?name=value&test=test1&test=test3", url);
        }
Beispiel #13
0
        public async Task when_invoking_get_async_it_should_invoke__get_async_on_user_repository()
        {
            // ARRANGE
            // testujemy UserService
            // user service wymaga w konstruktorze 3 instancji, dlatego je moqujemy
            var user       = new User(Guid.NewGuid(), "user", "test", "*****@*****.**", "secret");
            var accountDto = new AccountDto
            {
                Id    = user.Id,
                Role  = user.Role,
                Email = user.Email,
                Name  = user.Name
            };
            var userRepositoryMock = new Mock <IUserRepository>();
            var jwtHandlerMock     = new Mock <IJwtHandler>();
            var mapperMock         = new Mock <IMapper>();

            mapperMock.Setup(Xunit => Xunit.Map <AccountDto>(user)).Returns(accountDto);

            var userService = new UserService(userRepositoryMock.Object, jwtHandlerMock.Object,
                                              mapperMock.Object);

            userRepositoryMock.Setup(x => x.GetAsync(It.IsAny <Guid>())).ReturnsAsync(user);

            // ACT
            var existingAccountDto = await userService.GetAccountAsync(user.Id);

            // ASSERT
            userRepositoryMock.Verify(x => x.GetAsync(It.IsAny <Guid>()), Times.Once());
            accountDto.Should().NotBeNull();
            accountDto.Email.ShouldAllBeEquivalentTo(user.Email);
            accountDto.Role.ShouldAllBeEquivalentTo(user.Role);
            accountDto.Name.ShouldAllBeEquivalentTo(user.Name);
        }
		protected override System.Collections.Generic.IEnumerable<Xunit.Sdk.ITestCommand> EnumerateTestCommands(Xunit.Sdk.IMethodInfo method)
		{
			return base.EnumerateTestCommands(method).Select(enumerateTestCommand => new ActionTestCommandWrapper(enumerateTestCommand, o =>
			{
				((ReplicateToSql)o).ConnectionString=connectionStringSettings;
			}));
		}
Beispiel #15
0
        public void TestValidSources()
        {
            // Arrange
            string[] testValues = new[] { "http://bing.com", "http://microsoft.com", "https://paypal.com", "http://library" };

            TestValues(testValues, true);
        }
Beispiel #16
0
        public void TestInvalidSources()
        {
            // Arrange
            string[] testValues = new[] { null, "", "link", "c:\\dir", "\\username\folder", "127.0.0.1", "localhost", "crash;\\_andBurn", "ftp://bing.com", "gopher://kill.it", "http://" };

            TestValues(testValues, false);
        }
        public static void Y2015_Day13_GetMaximumTotalChangeInHappiness()
        {
            // Arrange
            string[] potentialHappiness = new[]
            {
                "Alice would gain 54 happiness units by sitting next to Bob.",
                "Alice would lose 79 happiness units by sitting next to Carol.",
                "Alice would lose 2 happiness units by sitting next to David.",
                "Bob would gain 83 happiness units by sitting next to Alice.",
                "Bob would lose 7 happiness units by sitting next to Carol.",
                "Bob would lose 63 happiness units by sitting next to David.",
                "Carol would lose 62 happiness units by sitting next to Alice.",
                "Carol would gain 60 happiness units by sitting next to Bob.",
                "Carol would gain 55 happiness units by sitting next to David.",
                "David would gain 46 happiness units by sitting next to Alice.",
                "David would lose 7 happiness units by sitting next to Bob.",
                "David would gain 41 happiness units by sitting next to Carol.",
            };

            // Act
            int actual = Day13.GetMaximumTotalChangeInHappiness(potentialHappiness);

            // Assert
            Assert.Equal(330, actual);
        }
        public async Task SaveApplicationWhenValidModel()
        {
            CreditCardApplication savedApplication = null;

            _mockRepository.Setup(Xunit => Xunit.AddAsync(It.IsAny <CreditCardApplication>()))
            .Returns(Task.CompletedTask)
            .Callback <CreditCardApplication>(x => savedApplication = x);

            var application = new NewCreditCardApplicationDetails
            {
                FirstName           = "Sarah",
                LastName            = "Smith",
                Age                 = 18,
                FrequentFlyerNumber = "012345-A",
                GrossAnnualIncome   = 100_000
            };

            await _sut.Index(application);

            _mockRepository.Verify(
                x => x.AddAsync(It.IsAny <CreditCardApplication>()), Times.Once);

            Assert.Equal(application.FirstName, savedApplication.FirstName);
            Assert.Equal(application.LastName, savedApplication.LastName);
            Assert.Equal(application.Age, savedApplication.Age);
            Assert.Equal(application.FrequentFlyerNumber, savedApplication.FrequentFlyerNumber);
            Assert.Equal(application.GrossAnnualIncome, savedApplication.GrossAnnualIncome);
        }
Beispiel #19
0
 public void Detect_anagrams()
 {
     var detector = new Anagram("allergy");
     var words = new[] { "gallery", "ballerina", "regally", "clergy", "largely", "leading" };
     var results = new[] { "gallery", "largely", "regally" };
     Assert.Equal(detector.Match(words), results);
 }
Beispiel #20
0
 public void Anagrams_are_case_insensitive()
 {
     var detector = new Anagram("Orchestra");
     var words = new[] { "cashregister", "Carthorse", "radishes" };
     var results = new[] { "Carthorse" };
     Assert.Equal(detector.Match(words), results);
 }
        public RemoveAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock<IAutoscaleOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new RemoveAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AzureOperationResponse()
            {
                RequestId = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
            };

            insightsAutoscaleOperationsMock.Setup(f => f.DeleteSettingAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AzureOperationResponse>(response))
                .Callback((string resourceGrp, string settingNm, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    settingName = settingNm;
                });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleOperations).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
Beispiel #22
0
 public void No_matches()
 {
     var detector = new Anagram("diaper");
     var words = new[] { "hello", "world", "zombies", "pants" };
     var results = new string[0];
     Assert.Equal(detector.Match(words), results);
 }
Beispiel #23
0
 public void BugfixingLeaderSorted_Test()
 {
     //var numbers = new int[] {1, 1, 1, 1, 50};
     //var numbers = new int[] {2, 2, 2, 2, 2, 3, 4, 4, 4, 6};
     var numbers = new[] {2, 2, 2, 2, 2, 3, 4, 4, 4};
     int result = Kata.Solution(numbers);
 }
Beispiel #24
0
 public void Identical_word_is_not_anagram()
 {
     var detector = new Anagram("corn");
     var words = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" };
     var results = new[] { "cron" };
     Assert.Equal(detector.Match(words), results);
 }
Beispiel #25
0
 public void Does_not_confuse_different_duplicates()
 {
     var detector = new Anagram("galea");
     var words = new[] { "eagle" };
     var results = new string[0];
     Assert.Equal(detector.Match(words), results);
 }
Beispiel #26
0
 public void Detect_multiple_anagrams()
 {
     var detector = new Anagram("master");
     var words = new[] { "stream", "pigeon", "maters" };
     var results = new[] { "maters", "stream" };
     Assert.Equal(detector.Match(words), results);
 }
Beispiel #27
0
 public void Detect_simple_anagram()
 {
     var detector = new Anagram("ant");
     var words = new[] { "tan", "stand", "at" };
     var results = new[] { "tan" };
     Assert.Equal(detector.Match(words), results);
 }
		public void CanCreateNestedScopeBlocks()
		{
			string template = "{{#with person}}Name: {{forename}} {{surname}}, {{#with job}}({{title}}){{/with}}{{/with}}";
			string expected = "Name: Matthew Abbott, (Developer)";
			var model = new { person = new { forename = "Matthew", surname = "Abbott", job = new { title = "Developer" } } };

			RenderTest(template, expected, model);
		}
		public void CanCreateScopeBlock()
		{
			string template = "{{#with person}}Name: {{forename}} {{surname}}{{/with}}";
			string expected = "Name: Matthew Abbott";
			var model = new { person = new { forename = "Matthew", surname = "Abbott" } };

			RenderTest(template, expected, model);
		}
		public void CanCreateAlternativeContentUsingElseTagUsingNegation()
		{
			string template = "{{#with person}}Name: {{forename}} {{surname}}, {{#with job}}({{title}}){{^}}Unemployed :-({{/with}}{{/with}}";
			string expected = "Name: Matthew Abbott, Unemployed :-(";
			var model = new { person = new { forename = "Matthew", surname = "Abbott" } };

			RenderTest(template, expected, model);
		}
        public void ContainsIgnoreCase_ignores_case()
        {
            var source = new[] { "AAA", "BBB" };

            Assert.True(source.ContainsIgnoreCase("aaa"));
            Assert.True(source.ContainsIgnoreCase("Aaa"));
            Assert.True(source.ContainsIgnoreCase("AAA"));
        }
Beispiel #32
0
		public void SelectUsingProjectToWithNullComplexSourceProperty()
		{
			var customers = new[] { new Customer { FirstName = "Bill", LastName = "White" } }.AsQueryable();

			var projected = customers.Project().To<CustomerDto>().SingleOrDefault();
			projected.ShouldNotBeNull();
			projected.Address.ShouldBeNull();
		}
        public async Task Post_Categoria()
        {
            var service = new CategoriasController(_mockContext.Object);

            await service.PostCategoria(_categoria);

            // Verifica se o método foi realmente chamado e se foi executado somente uma vez
            _mockSet.Verify(Xunit => Xunit.Add(_categoria), Times.Once);
            _mockContext.Verify(m => m.SaveChangesAsync(It.IsAny <CancellationToken>()), Times.Once());
        }
        public void ReferInvalidFrequentFlyerNumbers()
        {
            _mockValidator.Setup(x => x.IsValid(It.IsAny <string>())).Returns(false);

            var application = new CreditCardApplication();

            Assert.Equal(CreditCardApplicationDecision.ReferredToHuman, _sut.Evaluate(application));

            _mockValidator.Verify(Xunit => Xunit.IsValid(It.IsAny <string>()), Times.Once);
        }
Beispiel #35
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);
            }
Beispiel #36
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);
            }
Beispiel #37
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);
            }
Beispiel #38
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);
            }
Beispiel #39
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);
            }
Beispiel #40
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);
            }