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); } }
public void Handle(InvoiceOpenedEvent @event) { CustomerId = @event.CustomerId; IsOpen = true; }