Example #1
0
        public void CanEditOrderTestRepo()
        {
            var productRepo = new ProductFileRepo(Settings.ProductPath);
            var taxRepo     = new TaxFileRepo(Settings.TaxPath);

            var product = productRepo.LoadProducts("tile");
            var tax     = taxRepo.LoadTaxes("MN");

            OrderManager       manager  = new OrderManager(new FileOrderRepo(FilePath, Temp), productRepo, taxRepo);
            AddAnOrderResponse addOrder = manager.AddOrder(new DateTime(2018, 09, 25), "Name Test", tax, product, 100, 0);

            manager.AddToOrderRepo(addOrder.AddedOrder);

            addOrder.AddedOrder.Area         = 250;
            addOrder.AddedOrder.CustomerName = "Edited Name Test";

            manager.EditOrder(addOrder.AddedOrder);

            var orderResponse = manager.OrderLookupDate(addOrder.AddedOrder.OrderDate);
            var editedOrder   = orderResponse.ListOfOrders.SingleOrDefault(o => o.OrderNumber.Equals(addOrder.AddedOrder.OrderNumber));

            Assert.IsNotNull(editedOrder);
            Assert.AreEqual(addOrder.AddedOrder.Area, editedOrder.Area);
            Assert.AreEqual(addOrder.AddedOrder.CustomerName, editedOrder.CustomerName);
        }
Example #2
0
        public void CanAddOrderTest(string customerName, string state, string material, decimal area, bool success)
        {
            var productRepo = new ProductFileRepo(Settings.ProductPath);
            var taxRepo     = new TaxFileRepo(Settings.TaxPath);

            var product = productRepo.LoadProducts(material);
            var tax     = taxRepo.LoadTaxes(state);

            OrderManager manager = new OrderManager(new FileOrderRepo(FilePath, Temp), new ProductFileRepo(Settings.ProductPath), new TaxFileRepo(Settings.TaxPath));

            AddAnOrderResponse addOrder = manager.AddOrder(new DateTime(2020, 09, 25), customerName, tax, product, area, 0);

            manager.AddToOrderRepo(addOrder.AddedOrder);

            var thisOrder = manager.OrderLookupDate(new DateTime(2020, 09, 25));

            Assert.AreEqual(3, thisOrder.ListOfOrders.Count());
            var orderThatIAdded = thisOrder.ListOfOrders.SingleOrDefault(o => o.OrderNumber == addOrder.AddedOrder.OrderNumber);

            Assert.AreEqual(addOrder.AddedOrder.CustomerName, orderThatIAdded.CustomerName);
            Assert.AreEqual(addOrder.AddedOrder.Area, orderThatIAdded.Area);
            Assert.AreEqual(addOrder.AddedOrder.State, orderThatIAdded.State);
        }
Example #3
0
        public void CanDeleteOrder()
        {
            var productRepo = new ProductFileRepo(Settings.ProductPath);
            var taxRepo     = new TaxFileRepo(Settings.TaxPath);

            var product = productRepo.LoadProducts("tile");
            var tax     = taxRepo.LoadTaxes("MN");

            OrderManager manager = new OrderManager(new FileOrderRepo(FilePath, Temp), new ProductFileRepo(Settings.ProductPath), new TaxFileRepo(Settings.TaxPath));

            AddAnOrderResponse addResponse = manager.AddOrder(new DateTime(2020, 09, 25), "Name Test", tax, product, 100, 0);

            manager.AddToOrderRepo(addResponse.AddedOrder);

            var thisOrder = manager.OrderLookupDate(new DateTime(2020, 09, 25));

            Assert.AreEqual(3, thisOrder.ListOfOrders.Count());

            manager.DeleteOrder(addResponse.AddedOrder.OrderDate, addResponse.AddedOrder.OrderNumber);

            var afterDeleted = manager.OrderLookupDate(new DateTime(2020, 09, 25));

            Assert.AreEqual(2, afterDeleted.ListOfOrders.Count());
        }