public void When_PurchaseReserveProduct_NewProductHasNewQuantity()
        {
            Given(InitialEvents);

            var command = new PurchaseReservedProduct(id, 3);

            command.Metadata.CausationId   = command.Metadata.CommandId;
            command.Metadata.CorrelationId = causationAndCorrelationId;

            When(command);

            var expectedEvent = new ReservedProductPurchased(id, 3);

            expectedEvent.Metadata.CausationId   = command.Metadata.CommandId;
            expectedEvent.Metadata.CorrelationId = causationAndCorrelationId;
            expectedEvent.Metadata.ProcessId     = command.Metadata.ProcessId;

            Then(expectedEvent);
        }
コード例 #2
0
        internal void PurchaseReserved(PurchaseReservedProduct cmd)
        {
            // TODO: throw exception if reserved or available less than quantity

            RaiseEvent(new ReservedProductPurchased(cmd.AggregateId, cmd.Quantity));
        }