コード例 #1
0
        public void CanGenerateInvoiceForOrder()
        {
            // given
            InvoicingService service = AnyInvoicingService();
            Order            order   = AnyOrder();
            // when
            Invoice invoice = service.CreateInvoice(order);

            // then
            Check.That(invoice).IsNotNull();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public OrderCreatedEventHandler(InvoicingService invoicingService, IOrdersApi ordersApi)
 {
     this.invoicingService = invoicingService;
     this.ordersApi        = ordersApi;
 }