Esempio n. 1
0
        public void AllowToOpenAnInvoice()
        {
            var customerId  = "123";
            var openCommand = new OpenInvoiceCommand(customerId);

            InvoiceOpenedEvent invoiceEvent = null;

            using (this.invoiceRoot
                   .Where(x => x is InvoiceOpenedEvent)
                   .Select(x => x as InvoiceOpenedEvent)
                   .Subscribe(x => invoiceEvent = x))
            {
                this.invoice.SetupGet(x => x.IsBlank).Returns(true);

                this.invoiceRoot.Execute(this.invoice.Object, openCommand);
                Assert.Equal(customerId, invoiceEvent.CustomerId);
            }
        }
Esempio n. 2
0
 public void Handle(InvoiceOpenedEvent @event)
 {
     CustomerId = @event.CustomerId;
     IsOpen     = true;
 }