コード例 #1
0
        private void OnProductReservationCancelled(ProductReservationCancelled evt)
        {
            var product = GetProduct(evt);

            product.Reserved       -= evt.Quantity;
            product.LastEventNumber = evt.Metadata.EventNumber;
            _ctx.SaveChanges();
        }
コード例 #2
0
        public void When_CancelProductReservationLessThanReserved_ProductReservationCanceled()
        {
            Given(InitialEvents);

            var command = new CancelProductReservation(id, 10);

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

            When(command);

            var expectedEvent = new ProductReservationCancelled(id, 3);

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

            Then(expectedEvent);
        }
コード例 #3
0
 private void Apply(ProductReservationCancelled evt)
 {
     Reserved -= evt.Quantity;
 }