public void CanGenerateInvoiceForOrder() { // given InvoicingService service = AnyInvoicingService(); Order order = AnyOrder(); // when Invoice invoice = service.CreateInvoice(order); // then Check.That(invoice).IsNotNull(); }
public void Handle(SubmitOrderCommand command) { Order order = OrderRepository.Load(command.OrderId); ISpecification <Order> orderSpecification = GenerateSpecification(SystemUser); if (!orderSpecification.IsSatisfiedBy(order)) { throw new OrderOperationException("Order does not meet specification", order.Id); } //Domain logic order.Submit(); //Domain service Invoice invoice = InvoicingService.Issuance(order, GenerateTaxPolicy(SystemUser)); OrderRepository.Save(order); InvoiceRepository.Save(invoice); }
public OrderCreatedEventHandler(InvoicingService invoicingService, IOrdersApi ordersApi) { this.invoicingService = invoicingService; this.ordersApi = ordersApi; }