Example #1
0
        public void AnyModification_should_raise_domain_event()
        {
            IDomainEvent capturedDomainEvent = null;

            using (DomainEvent.TestWith(domainEvent => { capturedDomainEvent = domainEvent; }))
            {
                stockItem = StockItem.Create(productName, sizeName, dateCreated, user);
                capturedDomainEvent.ShouldBe <StockItemCreated>();

                stockItem.ReceiveStock(10, dateCreated, user);
                capturedDomainEvent.ShouldBe <ReceivedStock>();

                stockItem.Dispatch(5, 1, dateCreated, user);
                capturedDomainEvent.ShouldBe <DispatchedStock>();
            }
        }