public BaseSagaTests() { // LogManager.OutputToTrace(); _invoker = Substitute.For <IHandlerTypeInvoker>(); _di = Substitute.For <IContainerScope>(); _bus = Substitute.For <IDispatchMessages>(); _handler = new Handler(_bus); _storage = Substitute.For <IStoreSagaState>(); _saga = new MySagaState(); this.Setup(); }
public BaseSagaTests() { LogManager.OutputToTrace(); _invoker = Substitute.For<IHandlerTypeInvoker>(); _di = Substitute.For<IContainerScope>(); _bus = Substitute.For<IDispatchMessages>(); _handler = new Handler(_bus); _storage = Substitute.For<IStoreSagaState>(); _saga = new MySagaState(); this.Setup(); }
public async Task HandleAsync_StartSaga_should_publish_ProcessMySaga_message() { var state = new MySagaState(Guid.NewGuid()); var logger = NSubstitute.Substitute.For <ILogger <MySaga> >(); var sut = new MySaga(logger, state); var message = new StartSaga(Guid.NewGuid(), Guid.NewGuid()); var ctx = new FakeMessageContext <StartSaga>(message); await sut.HandleAsync(ctx); state.Outbox.Count.Should().Be(1); var outgoingMessage = state.Outbox.First(); outgoingMessage.Should().BeOfType <ProcessMySaga>(); outgoingMessage.CorrelationId.Should().Be(message.CorrelationId); }
public void saga_types_being_able_to_gimme_an_id_getter_for_the_state_object() { var types = new SagaTypes { MessageType = typeof(SagaMessageOne), StateType = typeof(MySagaState) }; var func = types.ToSagaIdFunc().ShouldBeOfType<Func<MySagaState, Guid>>(); var state = new MySagaState { Id = Guid.NewGuid() }; func(state).ShouldBe(state.Id); }