public void Is_The_Categorical_Discount_Correct() { //make a product Cart myCart = new Cart(); Product rice = new Product("rice", 45, "staple"); Product wheat = new Product("wheat", 45, "staple"); //make an addable cart Item by choosing a quantity int quantity = 4; CartItem item1 = new CartItem(rice, quantity); CartItem item2 = new CartItem(wheat, quantity); // add to cart myCart.AddItem(item1); myCart.AddItem(item2); IDiscount d = new Discounts().GetDiscounts("categorical"); double dis = d.GetTotalDiscount(myCart.CartItemList); Assert.Equal(288, 360 - dis); }
public void Is_The_Discount_Correct() { //make a product Cart myCart = new Cart(); Product rice = new Product("rice", 45); Product wheat = new Product("wheat", 45); //make an addable cart Item by choosing a quantity int quantity = 4; CartItem item1 = new CartItem(rice, quantity); CartItem item2 = new CartItem(wheat, quantity); // add to cart myCart.AddItem(item1); myCart.AddItem(item2); Discounts d = new Discounts(); double dis = d.GetTotalDiscount(myCart.CartItemList); //Assert.Equal(14.76, dis); Assert.Equal(345.24, myCart.DiscountedTotalCost); }