public static void WhenIGiveAValidItemReturnTheValueOfTheItem() { IStandardPricer pricer = new DefaultStandardPricer(); Assert.Equal(0.50M, pricer.GetPrice("A")); Assert.Equal(0.30M, pricer.GetPrice("B")); }
public static void WhenIGiveAnItemThatIsntWithinTheDictionaryExpectAKeyNotFoundException() { var input = "Z"; IStandardPricer pricer = new DefaultStandardPricer(); KeyNotFoundException ex = Assert.Throws <KeyNotFoundException>(() => pricer.GetPrice(input)); Assert.Equal($"Couldn't find item {input} in the dictionary", ex.Message); }
public static void WhenIGivenAnEmptyStringItemReturn0() { IStandardPricer pricer = new DefaultStandardPricer(); var expected = 0; var actual = pricer.GetPrice(""); Assert.Equal(expected, actual); }
public static void WhenIGiveSeveralItemsExpectTheTotal() { var input = "AAB"; IStandardPricer pricer = new DefaultStandardPricer(); var expected = 1.30M; var actual = pricer.GetPrice(input); Assert.Equal(expected, actual); }