Пример #1
0
        public void AggregatorMachine_Resolve_from_Inactive_Error()
        {
            var    machine      = new AggregatorMachine();
            IEvent resolveEvent = new ResolveEvent {
                Data = "Hello world?"
            };

            Assert.Throws <Exception>(() => machine.MoveNext(resolveEvent));
        }
Пример #2
0
        public void AggregatorMachine_Shipment_Moves_Aggregating()
        {
            var    machine = new AggregatorMachine();
            IEvent e       = new ShipmentEvent {
                Data = "world!"
            };

            machine.MoveNext(e);
            Assert.Equal(AggregatorState.Aggregating, machine.CurrentState);
        }
Пример #3
0
        public void AggregatorMachine_OnHand_Moves_Aggregating()
        {
            var    machine = new AggregatorMachine();
            IEvent e       = new OnHandEvent {
                Data = "Hello "
            };

            machine.MoveNext(e);
            Assert.Equal(AggregatorState.Aggregating, machine.CurrentState);
        }
Пример #4
0
        public void AggregatorMachine_OnHand_Shipment_Moves_Aggregating()
        {
            var    machine     = new AggregatorMachine();
            IEvent onHandEvent = new OnHandEvent {
                Data = "Hello "
            };
            IEvent shipmentEvent = new ShipmentEvent {
                Data = "world!"
            };

            machine.MoveNext(onHandEvent);
            machine.MoveNext(shipmentEvent);
            Assert.Equal(AggregatorState.Resolved, machine.CurrentState);
        }
Пример #5
0
        public void AggregatorMachine_Resolve_Moves_From_Resolved_Error()
        {
            var    machine     = new AggregatorMachine();
            IEvent onHandEvent = new OnHandEvent {
                Data = "Hello "
            };
            IEvent shipmentEvent = new ShipmentEvent {
                Data = "world!"
            };
            IEvent resolveEvent = new ResolveEvent {
                Data = "Hello world?"
            };

            machine.MoveNext(onHandEvent);
            machine.MoveNext(shipmentEvent);
            Assert.Throws <Exception>(() => machine.MoveNext(resolveEvent));
        }
Пример #6
0
        public void AggregatorMachine_ShouldStartInactive()
        {
            var machine = new AggregatorMachine();

            Assert.Equal(AggregatorState.Inactive, machine.CurrentState);
        }