Esempio n. 1
0
        public void AllowToCloseAnInvoice()
        {
            InvoiceClosedEvent invoiceEvent = null;

            using (this.invoiceRoot
                   .Where(x => x is InvoiceClosedEvent)
                   .Select(x => x as InvoiceClosedEvent)
                   .Subscribe(x => invoiceEvent = x))
            {
                this.invoice.SetupGet(x => x.Items).Returns(
                    new List <InvoiceItem> {
                    new InvoiceItem("1", 1m, 1u)
                }.AsReadOnly());
                this.invoice.SetupGet(x => x.Date).Returns(DateTime.Now);

                this.invoiceRoot.Execute(this.invoice.Object, new CloseInvoiceCommand());
                Assert.NotNull(invoiceEvent);
            }
        }
Esempio n. 2
0
 public void Handle(InvoiceClosedEvent @event)
 {
     IsOpen = false;
 }