コード例 #1
0
        public void When_ShipOrderCreated_ThrowInvalidOrderStateException()
        {
            var events = InitialEvents.Take(1).ToList();

            Given(events.ToArray());
            WhenThrows <ShipOrder, InvalidOrderStateException>(new ShipOrder(id));
        }
コード例 #2
0
        public void When_CancelOrderWhenShipped_CancelOrderFailed()
        {
            Given(InitialEvents.Take(3).ToArray());

            var command = new CancelOrder(id);

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

            WhenThrows <CancelOrder, InvalidOrderStateException>(command);
        }
        private void When_PrepareForShippingNoOrderLinesAdded_ThrowsInvalidOrderStateException()
        {
            Given(InitialEvents.Take(1).ToArray());

            var command = new PrepareOrderForShipping(id);

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

            WhenThrows <PrepareOrderForShipping, InvalidOrderStateException>(command);
        }
コード例 #4
0
        public void When_CancelOrder_OrderCancelled()
        {
            Given(InitialEvents.Take(2).ToArray());

            var command = new CancelOrder(id);

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

            When(command);

            var expectedEvent = new OrderCancelled(id);

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

            Then(expectedEvent);
        }
コード例 #5
0
 public void When_CheckOutEmpty_NothingHappens()
 {
     Given(InitialEvents.Take(1).ToArray());
     When(new CheckOutBasket(id, shippingAddress));
     Then(new IEvent[] { });
 }
コード例 #6
0
 public void When_RemoveItemEmptyBasket_NothingHappens()
 {
     Given(InitialEvents.Take(1).ToArray());
     When(new RemoveItemFromBasket(id, productId, 10));
     Then(new IEvent[] { });
 }