Beispiel #1
0
        public void CanAdd()
        {
            repo.CreateOrder(date, order);

            List <Orders> orders = repo.LoadOrders(date);

            Assert.AreEqual(3, orders.Count);

            Orders check = orders.FirstOrDefault(o => o.OrderNumber == 2);

            Assert.AreEqual(2, check.OrderNumber);
            Assert.AreEqual("Tou", check.CustomerName);
            Assert.AreEqual("IN", check.State);
            Assert.AreEqual(6.25, check.TaxRate);
            Assert.AreEqual("Tile", check.ProductType);
            Assert.AreEqual(100, check.Area);
            Assert.AreEqual(5.15, check.CostPerSquareFoot);
            Assert.AreEqual(4.75, check.LaborCostPerSquareFoot);
            Assert.AreEqual(515.00, check.MaterialCost);
            Assert.AreEqual(475, check.LaborCost);
            Assert.AreEqual(61.88, check.Tax);
            Assert.AreEqual(1051.88, check.Total);

            repo.DeleteOrder(order);
        }
Beispiel #2
0
        public void CanEdit()
        {
            repo = new OrderTestRepository();
            List <Orders> orders = repo.LoadOrders(date);

            Orders order = orders[0];

            order.CustomerName = "Tom";
            order.State        = "IN";

            repo.UpdateOrder(order);
            Assert.AreEqual(2, orders.Count);

            orders = repo.LoadOrders(date);
            Orders check = orders.FirstOrDefault(o => o.OrderNumber == 1);

            Assert.AreEqual(1, check.OrderNumber);
            Assert.AreEqual("Tom", check.CustomerName);
            Assert.AreEqual("IN", check.State);
            Assert.AreEqual(6.25, check.TaxRate);
            Assert.AreEqual("Wood", check.ProductType);
            Assert.AreEqual(100, check.Area);
            Assert.AreEqual(5.15, check.CostPerSquareFoot);
            Assert.AreEqual(4.75, check.LaborCostPerSquareFoot);
            Assert.AreEqual(515.00, check.MaterialCost);
            Assert.AreEqual(475, check.LaborCost);
            Assert.AreEqual(61.88, check.Tax);
            Assert.AreEqual(1051.88, check.Total);
        }
Beispiel #3
0
        public void CanDelete()
        {
            repo = new OrderTestRepository();
            Orders order = new Orders()
            {
                OrderNumber = 2
            };

            repo.DeleteOrder(order);

            List <Orders> orders = repo.LoadOrders(date);

            Assert.AreEqual(1, orders.Count);

            Orders check = orders.FirstOrDefault(o => o.OrderNumber == 1);

            Assert.AreEqual(1, check.OrderNumber);
            Assert.AreEqual("Wise", check.CustomerName);
            Assert.AreEqual("OH", check.State);
            Assert.AreEqual(6.25, check.TaxRate);
            Assert.AreEqual("Wood", check.ProductType);
            Assert.AreEqual(100, check.Area);
            Assert.AreEqual(5.15, check.CostPerSquareFoot);
            Assert.AreEqual(4.75, check.LaborCostPerSquareFoot);
            Assert.AreEqual(515.00, check.MaterialCost);
            Assert.AreEqual(475, check.LaborCost);
            Assert.AreEqual(61.88, check.Tax);
            Assert.AreEqual(1051.88, check.Total);

            repo.CreateOrder(date, order);
        }
Beispiel #4
0
        public void CanAddOrderTest()
        {
            Manager manager = ManagerFactory.Create();

            OrderTestRepository repo = new OrderTestRepository();

            Order orderToAdd = new Order()
            {
                OrderDate              = DateTime.Parse("07/01/2019"),
                CustomerName           = "James",
                State                  = "MI",
                TaxRate                = 5.75M,
                ProductType            = "Carpet",
                Area                   = 100.00M,
                CostPerSquareFoot      = 2.25M,
                LaborCostPerSquareFoot = 2.10M
            };

            Order order = manager.CreateNewOrder(orderToAdd.OrderDate, orderToAdd.CustomerName, orderToAdd.State, orderToAdd.ProductType, orderToAdd.Area);

            manager.AddOrder(order);

            List <Order> orderList = repo.LoadOrders(order.OrderDate);

            Assert.AreEqual(225, order.MaterialCost);
            Assert.AreEqual(3, orderList.Count());
        }
Beispiel #5
0
        public void CanLoadList()//run all together than wont passed
        {
            repo = new OrderTestRepository();

            List <Orders> orders = repo.LoadOrders(date);

            Assert.AreEqual(2, orders.Count);

            Orders check = orders.FirstOrDefault(o => o.OrderNumber == 1);

            Assert.AreEqual(1, check.OrderNumber);
            Assert.AreEqual("Wise", check.CustomerName);
            Assert.AreEqual("OH", check.State);
            Assert.AreEqual(6.25, check.TaxRate);
            Assert.AreEqual("Wood", check.ProductType);
            Assert.AreEqual(100, check.Area);
            Assert.AreEqual(5.15, check.CostPerSquareFoot);
            Assert.AreEqual(4.75, check.LaborCostPerSquareFoot);
            Assert.AreEqual(515.00, check.MaterialCost);
            Assert.AreEqual(475, check.LaborCost);
            Assert.AreEqual(61.88, check.Tax);
            Assert.AreEqual(1051.88, check.Total);
        }