public void ConfigureTest() { // Complex model var customer = new Customer { Name = "George Costanza" }; var order = new Order { Customer = customer, id = 0 }; var bosco = new Product { Name = "Bosco", Price = 4.99m }; order.AddOrderLineItem(bosco, 15); AutoMapperConfiguration.Configure(); // Configure AutoMapper OrderDetailsViewModel dto = Mapper.Map<Order, OrderDetailsViewModel>(order); //Assert Assert.AreEqual("George Costanza", dto.CustomerName, "Customer name doesn't match"); Assert.AreEqual("£74.85", dto.Total, "Total does not match"); Assert.AreEqual(dto.OrderLineItem[0], "Bosco: Quantity - 15", "Order Line item Does not match"); }
public void Add(Order order) { orders.Add(order); }
public void Save(Order order) { var result = db.Orders.Where(o => o.id == order.id).ToList().Count; if (result <= 0) db.Add(order); }