private OrderItem GetOrderItem(CreateOrderItemCommand requestOrderDetail, IEnumerable <IReadonlyProduct> products) { var productId = new ProductIdentity(requestOrderDetail.ProductId); var product = products.Single(e => e.Id == productId); var unitPrice = product.ListPrice; var quantity = requestOrderDetail.Quantity; return(_orderFactory.CreateOrderItem(productId, unitPrice, quantity)); }
public void Dado_um_pedido_sem_itens_o_mesmo_nao_deve_ser_gerado() { var command = new CreateOrderCommand(); var item = new CreateOrderItemCommand(Guid.NewGuid(), 0); command.Customer = "12345678"; command.ZipCode = "12345678"; command.PromoCode = "12345678"; item.Validate(); Assert.AreEqual(item.Valid, false); // Assert.Fail(); }
public GenericCommandResult CreateOrder( [FromBody] CreateOrderItemCommand command, [FromServices] OrderHandler handler) { return((GenericCommandResult)handler.Handle(command)); }