Example #1
0
            public async Task GetProducts_WhenCalled_ReturnsRightAnnualCost(string consumption, int expectedAnnualCostProductA, int expectedAnnualCostProductB)
            {
                // Act
                var result = await TariffServiceUnderTest.GetProducts(consumption);

                // Assert
                Assert.Equal(expectedAnnualCostProductA, result.FirstOrDefault(c => c.Name == "basic electricity tariff").AnnualCost);
                Assert.Equal(expectedAnnualCostProductB, result.FirstOrDefault(c => c.Name == "Packaged tariff").AnnualCost);
            }
Example #2
0
            public void Should_Throw_TariffException_When_Consumption_IsInvalid()
            {
                // Arange
                string consumption = "invalid";

                // Act
                var result = TariffServiceUnderTest.GetProducts(consumption);

                // Assert
                Assert.ThrowsAsync <TariffException>(async() => await result);
            }
Example #3
0
            public async Task Get_WhenCalled_ReturnsAllItems()
            {
                // Arange
                string consumption = "3500";

                // Act
                var result = await TariffServiceUnderTest.GetProducts(consumption);

                // Assert
                Assert.Equal(2, result.Count());
            }