public async Task LivingSearchStateMachine_Should_Be_Tested() { var config = new MessageBusConfig { PubmedParserQueueName = "pubmedParser", PubmedSearchQueueName = "pubmedSearch", RabbitMqConfig = new RabbitMqConfig { SchemeName = "rabbitmq", Hostname = "localhost", Username = "******", Password = "******" } }; var machine = new LivingSearchStateMachine(config); var harness = new InMemoryTestHarness(); var sagaHarness = harness.StateMachineSaga <LivingSearchState, LivingSearchStateMachine>(machine); var saga = harness.Saga <LivingSearchState>(); await harness.Start(); try { Guid sagaId = NewId.NextGuid(); await harness.Bus.Publish <ILivingSearchEnabledOnProjectEvent>(new { ProjectId = default(Guid), LivingSearchId = sagaId, SearchString = default(string), UpdateInterval = default(int), BatchSize = default(int), SearchEngineName = default(string), SystematicSearchPrefix = default(string) }); // did the endpoint consume the message Assert.NotNull(harness.Sent); Assert.True(harness.Consumed.Select <ILivingSearchEnabledOnProjectEvent>().Any()); // did the actual consumer consume the message Assert.True(sagaHarness.Consumed.Select <ILivingSearchEnabledOnProjectEvent>().Any()); var instance = sagaHarness.Created.ContainsInState(sagaId, machine, machine.Initial); Assert.NotNull(instance); } finally { await harness.Stop(); } }
public async Task A_saga_is_being_tested() { _sagaId = Guid.NewGuid(); _testValueA = "TestValueA"; _harness = new InMemoryTestHarness(); _saga = _harness.Saga <TestSaga>(); await _harness.Start(); await _harness.InputQueueSendEndpoint.Send(new A { CorrelationId = _sagaId, Value = _testValueA }); }
public Initiating_or_orchestrating_a_consumer_saga() { _sagaHarness = InMemoryTestHarness.Saga <ConsumerSaga>(); }