コード例 #1
0
        public void CanEditOrder()
        {
            DateTime            orderDate = DateTime.Parse("10/16/2016");
            FileOrderRepository repo      = new FileOrderRepository();
            List <Order>        orders    = repo.List(orderDate);

            Order editedOrder = orders[0];

            editedOrder.Area = 7000;

            repo.Edit(editedOrder, 1);

            orders = repo.List(orderDate);

            Assert.AreEqual(4, orders.Count);

            Order check = orders[0];

            Assert.AreEqual(1, check.OrderNumber);
            Assert.AreEqual("James Camerson", check.Name);
            Assert.AreEqual("MN", check.State);
            Assert.AreEqual(new DateTime(2016, 10, 16), check.OrderDate);
            Assert.AreEqual(7000, check.Area);
            Assert.AreEqual(ProductType.Carpet, check.Type);
            Assert.AreEqual(112.50, check.CostMaterial);
            Assert.AreEqual(105.00, check.CostLabor);
            Assert.AreEqual(15.23, check.Tax);
            Assert.AreEqual(232.73, check.TotalCost);
        }
コード例 #2
0
        public void CanEditOrder(int year, int month, int day, string name, string productType, string stateAbrr, decimal area, bool expectedValue)
        {
            FileOrderRepository repo = new FileOrderRepository(filePath);
            DateTime            date = new DateTime(year, month, day);

            List <Order> orders = repo.ListOrdersForDate(date);

            Order editedOrder = orders[0];

            editedOrder.CustomerName = name;
            editedOrder.ProductType  = productType;
            editedOrder.State        = stateAbrr;
            editedOrder.Area         = area;

            repo.Edit(editedOrder);

            repo.ListOrdersForDate(date);
            Order check = orders[0];

            Assert.AreEqual("Nikki", check.CustomerName);
            Assert.AreEqual("Carpet", check.ProductType);
            Assert.AreEqual("MI", check.State);
            Assert.AreEqual(120.00, check.Area);
        }