public void State_is_changed() { var given = new Given_State_SoftareProgramming_Saga(SoftwareProgrammingSaga.States.MakingCoffee); When_execute_valid_transaction(given.SagaMachine, new CoffeMadeEvent(Guid.NewGuid(), Guid.NewGuid())); Assert.AreEqual(SoftwareProgrammingSaga.States.Coding, given.SagaMachine.State.MachineState); }
public void State_is_changed_on_using_non_generic_transit_method() { var given = new Given_State_SoftareProgramming_Saga(SoftwareProgrammingSaga.States.MakingCoffee); object msg = new CoffeMadeEvent(Guid.NewGuid(), Guid.NewGuid()); given.SagaMachine.Transit(msg); Assert.AreEqual(SoftwareProgrammingSaga.States.Coding, given.SagaMachine.State.MachineState); }
public void State_raised_creation_event_on_machine_creation() { var given = new Given_State_SoftareProgramming_Saga( SoftwareProgrammingSaga.States.MakingCoffee); var creationEvent = given.SagaDataAggregate.GetEvent <DomainEvent>(); Assert.IsInstanceOf <SagaCreatedEvent <SoftwareProgrammingSaga.States> >(creationEvent); }
public void Commands_are_produced() { var given = new Given_State_SoftareProgramming_Saga(SoftwareProgrammingSaga.States.Coding); var subscriptionExpiredEvent = new GotTiredEvent(Guid.NewGuid()); When_execute_valid_transaction(given.SagaInstance, subscriptionExpiredEvent); CollectionAssert.IsNotEmpty(given.SagaInstance.CommandsToDispatch); }
public void State_transitioned_events_are_filled_with_sagadata() { var given = new Given_State_SoftareProgramming_Saga(SoftwareProgrammingSaga.States.MakingCoffee); given.SagaDataAggregate.ClearEvents(); When_execute_valid_transaction(given.SagaInstance, new CoffeMadeEvent(Guid.NewGuid(), Guid.NewGuid())); var stateChangeEvent = given.SagaDataAggregate.GetEvent <SagaTransitionEvent <SoftwareProgrammingSaga.States, SoftwareProgrammingSaga.Triggers> >(); Assert.AreEqual(given.SagaDataAggregate.MachineState, stateChangeEvent.State); }
public void State_transitioned_event_is_raised() { var given = new Given_State_SoftareProgramming_Saga(SoftwareProgrammingSaga.States.MakingCoffee); given.SagaDataAggregate.ClearEvents(); When_execute_valid_transaction(given.SagaMachine, new CoffeMadeEvent(Guid.NewGuid(), Guid.NewGuid())); var stateChangeEvent = given.SagaDataAggregate.GetEvent <SagaTransitionEvent <SoftwareProgrammingSaga.States, SoftwareProgrammingSaga.Triggers> >(); Assert.NotNull(stateChangeEvent); }
public void SagaData_is_changed_after_transition_by_event_data() { var given = new Given_State_SoftareProgramming_Saga(SoftwareProgrammingSaga.States.Coding); given.SagaDataAggregate.ClearEvents(); var gotTiredEvent = new GotTiredEvent(Guid.NewGuid()); When_execute_valid_transaction(given.SagaInstance, gotTiredEvent); var personId = given.SagaDataAggregate.PersonId; Assert.AreEqual(gotTiredEvent.SourceId, personId); }
public Given_AutomatonymousSagas_When_apply_known_but_not_mapped_event_in_state(Given_State_SoftareProgramming_Saga given) { _given = given; }