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); }
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); }
public async Task Get_WhenCalled_ReturnsAllItems() { // Arange string consumption = "3500"; // Act var result = await TariffServiceUnderTest.GetProducts(consumption); // Assert Assert.Equal(2, result.Count()); }