public void ConsumingStarted_WhenStmInConsumingState_Throws(EventStreamConsumerStateMachine stm, int eventCount)
        {
            Receive(stm, eventCount);
            stm.ConsumingStarted();

            Assert.Throws <InvalidOperationException>(() => stm.ConsumingStarted());
        }
        public void ConsumerClosed_WhenStmConsumedState_DoesNotThrow(EventStreamConsumerStateMachine stm, int eventCount)
        {
            Receive(stm, eventCount);
            Consume(stm);

            stm.ConsumerClosed();
        }
        public void ReceivingCompleted_WhenStmInConsumedState_Throws(EventStreamConsumerStateMachine stm, int eventCount)
        {
            Receive(stm, eventCount);
            Consume(stm);

            Assert.Throws <InvalidOperationException>(() => stm.ReceivingCompleted(eventCount));
        }
        public void ConsumingStarted_WhenStmInClosedState_Throws(EventStreamConsumerStateMachine stm)
        {
            stm.ConsumerClosed();

            Assert.Throws <InvalidOperationException>(() => stm.ConsumingStarted());
        }
        public void ConsumingStarted_WhenStmInReceivingCompletedState_DoesNotThrow(EventStreamConsumerStateMachine stm, int eventCount)
        {
            Receive(stm, eventCount);

            stm.ConsumingStarted();
        }
 private static void Consume(EventStreamConsumerStateMachine stm)
 {
     stm.ConsumingStarted();
     stm.ConsumingCompleted();
 }
 private static void Receive(EventStreamConsumerStateMachine stm, int eventCount)
 {
     stm.ReceivingStarted();
     stm.ReceivingCompleted(eventCount);
 }
 public void ConsumerClosed_WhenStmInInitialState_DoesNotThrow(EventStreamConsumerStateMachine stm)
 {
     stm.ConsumerClosed();
 }
 public void ConsumingCompleted_WhenStmInInitialState_Throws(EventStreamConsumerStateMachine stm)
 {
     Assert.Throws <InvalidOperationException>(() => stm.ConsumingCompleted());
 }
 public void ReceivingStarted_WhenStmInInitalState_DoesNotThrow(EventStreamConsumerStateMachine stm)
 {
     stm.ReceivingStarted();
 }