예제 #1
0
        public async Task State_in_transition_result_is_changed()
        {
            var given = new Given_Automatonymous_Process(m => m.MakingCoffee);
            await given.Process.Transit(given.State, new CoffeMadeEvent(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            Assert.Equal(nameof(SoftwareProgrammingProcess.Coding), given.State.CurrentStateName);
        }
예제 #2
0
        public async Task State_is_changed_on_using_non_generic_transit_method()
        {
            var    given = new Given_Automatonymous_Process(m => m.MakingCoffee);
            object msg   = new CoffeMadeEvent(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
            await given.Process.Transit(given.State, msg);

            Assert.Equal(nameof(SoftwareProgrammingProcess.Coding), given.State.CurrentStateName);
        }
예제 #3
0
        public async Task Process_state_is_changed_after_transition_by_event_data()
        {
            var given = new Given_Automatonymous_Process(m => m.Coding);

            var subscriptionExpiredEvent = new GotTiredEvent(Guid.NewGuid().ToString());
            await given.Process.Transit(given.State, subscriptionExpiredEvent);

            Assert.Equal(subscriptionExpiredEvent.SourceId, given.State.PersonId);
        }
예제 #4
0
        public async Task Commands_are_produced()
        {
            var given = new Given_Automatonymous_Process(m => m.Coding);

            var subscriptionExpiredEvent = new GotTiredEvent(Guid.NewGuid().ToString());
            var commands = await given.Process.Transit(given.State, subscriptionExpiredEvent);

            Assert.NotEmpty(commands);
        }
 public Given_AutomatonymousProcess_When_invalid_Transitions(ITestOutputHelper output)
 {
     _given = new Given_Automatonymous_Process(m => m.Sleeping);
 }