public void TestCheckStock()
        {
            OrderTasks     ot         = new OrderTasks();
            List <Product> emptyItems = new List <Product>();
            Order          emptyOrder = new Order(emptyItems);

            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);

            CustomerTasks ct        = new CustomerTasks();
            int           postCheck = ct.CheckStock(testCheese);
            int           realStock = testCheese.Stock;

            Assert.Equal(realStock, postCheck);
        }
        public void TestStockReplenishAfterOrderCanceled()
        {
            OrderTasks     ot         = new OrderTasks();
            List <Product> emptyItems = new List <Product>();
            Order          emptyOrder = new Order(emptyItems);

            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);
            ot.CancelOrder(emptyOrder);

            int cheeseStock = testCheese.Stock;
            int maxCheese   = Cheese.MaxStock;

            Assert.Equal(maxCheese, cheeseStock);
        }
        public void TestStockReduction()
        {
            OrderTasks     ot         = new OrderTasks();
            List <Product> emptyItems = new List <Product>();
            Order          emptyOrder = new Order(emptyItems);

            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);

            int cheeseStock   = testCheese.Stock;
            int maxCheese     = Cheese.MaxStock;
            int expectedStock = maxCheese - 3;

            Assert.Equal(expectedStock, cheeseStock);
        }
        public void TestRestock()
        {
            OrderTasks     ot         = new OrderTasks();
            List <Product> emptyItems = new List <Product>();
            Order          emptyOrder = new Order(emptyItems);

            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testCheese);

            int           postOrder = testCheese.Stock;
            EmployeeTasks et        = new EmployeeTasks();

            et.RestockProductGlobal(testCheese);
            int postRestock = testCheese.Stock;

            Assert.Equal(postOrder + 3, postRestock);
        }
        public void TestUpdateOrderPrice()
        {
            List <Product> emptyItems = new List <Product>();
            Order          emptyOrder = new Order(emptyItems);
            OrderTasks     ot         = new OrderTasks();

            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testMilk);
            ot.AddProduct(emptyOrder, testIceCream);

            double priceBeforeUpdate = ot.OrderPrice(emptyOrder);

            ot.AddProduct(emptyOrder, testIceCream);
            emptyOrder.UpdatePrice();
            double priceAfterUpdate = (ot.OrderPrice(emptyOrder));
            double expectedPrice    = priceBeforeUpdate + testIceCream.Price;

            Assert.Equal(expectedPrice, priceAfterUpdate);
        }
        public void TestAddProducttoItemList()
        {
            List <Product> testItems = new List <Product>();

            testItems.Add(testCheese);
            testItems.Add(testMilk);
            testItems.Add(testIceCream);

            Order      testOrder = new Order(testItems);
            OrderTasks ot        = new OrderTasks();

            List <Product> emptyItems = new List <Product>();
            Order          emptyOrder = new Order(emptyItems);

            ot.AddProduct(emptyOrder, testCheese);
            ot.AddProduct(emptyOrder, testMilk);
            ot.AddProduct(emptyOrder, testIceCream);

            Assert.Equal(emptyOrder.Items, testOrder.Items);
        }