public void CanAddOrderToFile() { DateTime orderDate = DateTime.Parse("10/16/2016"); FileOrderRepository repo = new FileOrderRepository(); List <Order> orders = repo.List(orderDate); Order newOrder = new Order(); newOrder.OrderNumber = 5; newOrder.Name = "Rickstar Fredders"; newOrder.State = "MN"; newOrder.OrderDate = orderDate; newOrder.Area = 222; newOrder.Type = ProductType.Tile; newOrder.CostMaterial = 777.00M; newOrder.CostLabor = 921.30M; repo.Add(newOrder); orders = repo.List(orderDate); Assert.AreEqual(5, orders.Count()); Order check = orders[4]; Assert.AreEqual(5, check.OrderNumber); Assert.AreEqual("Rickstar Fredders", check.Name); Assert.AreEqual("MN", check.State); Assert.AreEqual(new DateTime(2016, 10, 16), check.OrderDate); Assert.AreEqual(222, check.Area); Assert.AreEqual(ProductType.Tile, check.Type); Assert.AreEqual(777.00, check.CostMaterial); Assert.AreEqual(921.30, check.CostLabor); }
public void CanAddOrder(int year, int month, int day, int orderNumber, string customerName, string state, decimal taxRate, string productType, decimal area, decimal costPerSquareFoot, decimal laborCostPerSquareFoot, bool expectedResult) { DateTime date = new DateTime(year, month, day); Order order = new Order(); order.Date = date; order.OrderNumber = orderNumber; order.CustomerName = customerName; order.State = state; order.TaxRate = taxRate; order.ProductType = productType; order.Area = area; order.CostPerSquareFoot = costPerSquareFoot; order.LaborCostPerSquareFoot = laborCostPerSquareFoot; FileOrderRepository repo = new FileOrderRepository(filePath); bool actual = repo.Add(order); Assert.AreEqual(expectedResult, actual); }