public CheckoutTests() { // Setup dates for MultiDeal halfWeekInterval = new TimeSpan(3, 12, 0, 0); lastWeek = DateTime.Now.Subtract(halfWeekInterval); nextWeek = DateTime.Now.Add(halfWeekInterval); now = DateTime.Now; // Setup products Product productA = new Product("A", 50, new MultiDeal(3, 130, lastWeek, nextWeek)); Product productB = new Product("B", 30, new MultiDeal(2, 145, lastWeek, nextWeek)); Product productC = new Product("C", 20); Product productD = new Product("D", 15); // Populate inventory productInventory = new ProductInventoryController(); productInventory.Add(productA); productInventory.Add(productB); productInventory.Add(productC); productInventory.Add(productD); // Populate shopping trolley shoppingTrolley = new ShoppingTrolleyController(); shoppingTrolley.AddBulk(new Product("A", 50, new MultiDeal(3, 130, lastWeek, nextWeek)), 8); // Expected cost = 360 shoppingTrolley.AddBulk(new Product("B", 30, new MultiDeal(2, 145, lastWeek, nextWeek)), 5); // Expected cost = 120 shoppingTrolley.AddBulk(new Product("C", 20), 10); // Expected cost = 200 shoppingTrolley.AddBulk(new Product("D", 15), 4); // Expected cost = 60 // Total expected cost = 740 }
public ShoppingTrolleyController() { this.shoppingTrolley = new ShoppingTrolleyDictionary(); }