示例#1
0
        public void CanReadOrderFromFile()
        {
            Order order = new Order();
            ProdOrderRepository prodOrderRepo = new ProdOrderRepository();

            order.Date = DateTime.Parse("09/26/2018");
            var orders = prodOrderRepo.GetAllOrdersForDate(order.Date);

            Assert.AreEqual(4, orders.Count);

            Order orderToCheck = orders[1];

            Assert.AreEqual("Rob", orderToCheck.CustomerName);
        }
示例#2
0
        public void CanRemoveOrderFromFile()
        {
            Order order = new Order();
            ProdOrderRepository prodOrderRepo = new ProdOrderRepository();

            order.Date        = DateTime.Parse("09/26/2018");
            order.OrderNumber = 1;
            var orderToRemove = prodOrderRepo.GetOrder(order.Date, order.OrderNumber);

            prodOrderRepo.RemoveThisOrder(order);

            var orders = prodOrderRepo.GetAllOrdersForDate(order.Date);

            Assert.AreEqual(3, orders.Count);
        }
示例#3
0
        public void CanAddOrderToFile()
        {
            Order order = new Order();
            ProdOrderRepository   prodOrderRepo   = new ProdOrderRepository();
            ProdProductRepository prodProductRepo = new ProdProductRepository();
            ProdTaxRepository     prodTaxRepo     = new ProdTaxRepository();

            order.Date         = DateTime.Parse("09/26/2018");
            order.CustomerName = "Bill";
            order.State        = "Michigan";
            order.ProductType  = "Wood";
            order.Area         = 100M;
            prodOrderRepo.CommitThisOrder(order);

            var orders = prodOrderRepo.GetAllOrdersForDate(order.Date);

            Assert.AreEqual(5, orders.Count);
        }
示例#4
0
        public void CanEditOrderFromFile()
        {
            Order order = new Order();
            ProdOrderRepository prodOrderRepo = new ProdOrderRepository();

            order.Date        = DateTime.Parse("09/26/2018");
            order.OrderNumber = 1;
            var orderToEdit = prodOrderRepo.GetOrder(order.Date, order.OrderNumber);

            order.CustomerName = "Tommy";
            order.ProductType  = "Laminate";
            order.Area         = 600;
            order.State        = "Pennsylvania";
            prodOrderRepo.UpdateThisOrder(order);
            var orders = prodOrderRepo.GetAllOrdersForDate(order.Date);

            Assert.AreEqual(4, orders.Count);
            var editedOrder = orders[0];

            Assert.AreEqual("Tommy", editedOrder.CustomerName);
            Assert.AreEqual("Pennsylvania", editedOrder.State);
            Assert.AreEqual(600, editedOrder.Area);
            Assert.AreEqual("Laminate", editedOrder.ProductType);
        }