public static void Main() { ShoppingCart shoppingCart = new ShoppingCart { HasCoupon = true, CouponTotalPriceThreshold = 10.00m, CouponDiscount = 1.00m }; shoppingCart.Add(CreateLineItems()); Console.WriteLine(shoppingCart.ToString()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
public void PrintShoppingCartTest() { // arrange ShoppingCart shoppingCart = new ShoppingCart { HasCoupon = true, CouponTotalPriceThreshold = 10.00m, CouponDiscount = 1.00m }; List<LineItem> lineItemList = new List<LineItem> { // Fixed price line items new FixedPriceLineItem { ProductId = 1, Name = "Cheerios (non GMO)", UnitPrice = 2.00m, Quantity = 3, IsDiscounted = true, DiscountThreshold = 2 }, new FixedPriceLineItem { ProductId = 2, Name = "Milk", UnitPrice = 3.00m, Quantity = 2, IsDiscounted = false }, // By weight line items new ByWeightPriceLineItem { ProductId = 3, Name = "Apples", PricePerPound = 1.00m, WeightInPounds = 1.75 }, new ByWeightPriceLineItem { ProductId = 4, Name = "Oranges", PricePerPound = 2.00m, WeightInPounds = 1.50 } }; shoppingCart.Add(lineItemList); //act string shoppingCartString = shoppingCart.ToString(); // assert Assert.AreNotEqual(0, shoppingCartString.Length); }