Exemple #1
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);
        }
Exemple #2
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));
        }
Exemple #3
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));
        }
Exemple #4
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);
        }
Exemple #5
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);
        }