public void TestBasketWithMultipleQualifyingDistcountProductWithMultipleSameProductOddNumber() { // arrange decimal expectedValue = 3.05M; var products = new List <string>(); products.Add("A99"); products.Add("B15"); products.Add("A99"); products.Add("A99"); products.Add("B15"); products.Add("A99"); products.Add("A99"); products.Add("B15"); var engine = new CheckoutEngine(); // act var checkoutEngine = new CheckoutEngine(); var result = checkoutEngine.CalculateBasket(products); // assert Assert.AreEqual(expectedValue, result); }
public void TestNullProductList() { // arrange var expectedError = "Products cannot be null or empty."; try { // act var checkoutEngine = new CheckoutEngine(); var result = checkoutEngine.CalculateBasket(null); } catch (ArgumentException ex) { // assert Assert.AreEqual(expectedError, ex.ParamName); } }
public void TestBasketWithUnknownProduct() { // arrange decimal expectedValue = 0.00M; var products = new List <string>(); products.Add("A88"); var engine = new CheckoutEngine(); // act var checkoutEngine = new CheckoutEngine(); var result = checkoutEngine.CalculateBasket(products); // assert Assert.AreEqual(expectedValue, result); }
public void TestBasketWithNoQualifyingDiscountProduct() { // arrange decimal expectedValue = 3.29M; var products = new List <string>(); products.Add("A99"); products.Add("C40"); products.Add("T23"); var engine = new CheckoutEngine(); // act var checkoutEngine = new CheckoutEngine(); var result = checkoutEngine.CalculateBasket(products); // assert Assert.AreEqual(expectedValue, result); }
public async Task <decimal> CalculateBasket(List <string> products) { var checkoutEngine = new CheckoutEngine(); return(await Task.FromResult(checkoutEngine.CalculateBasket(products))); }