public void AddOrderLineItem(Product product, int quantity) { _orderLineItems.Add(new OrderLineItem(product, quantity)); }
public OrderLineItem(Product product, int quantity) { Product = product; Quantity = quantity; }
public void FlatteringTest() { var customer = new Customer { Name = "George Costanza" }; var order = new Order { Customer = customer }; var bosco = new Product { Name = "Bosco", Price = 4.99m }; order.AddOrderLineItem(bosco, 15); var m = Mapper.Create<Order, OrderDto>(); var dto = m(order); Assert.AreEqual(74.85m, dto.Total); Assert.AreSame(customer.Name, dto.CustomerName); }