Exemplo n.º 1
0
        public void When(IEvent @event)
        {
            var cmd   = ShippingPolicy.When((dynamic)@event);
            var state = history.Rehydrate <Order>();

            history.AddRange(OrderBehavior.Handle(state, (dynamic)cmd));
        }
Exemplo n.º 2
0
        public void PickedDoesntIssueShip()
        {
            //Given
            var state = new IEvent[] {
            }.Rehydrate <Order>();

            //When
            var cmd = ShippingPolicy.When(new GoodsPicked(), state);

            //Then
            Assert.Null(cmd);
        }
Exemplo n.º 3
0
        public void PickedAndPayedIssueShip()
        {
            //Given
            var state = new IEvent[] {
                new GoodsPicked()
            }.Rehydrate <Order>();

            //When
            var cmd = ShippingPolicy.When(new PaymentRecieved(), state);

            //Then
            Assert.NotNull(cmd);
            Assert.IsType <Ship>(cmd);
        }