public MetadataPipelineHookConsumingTests() { initialisationTime = new DateTime(1905, 9, 13); TimeProvider.Current = new StubTimeProvider(initialisationTime); sut = new MetadataPipelineHook(new JsonNetSerialiser()); correlationId = Guid.NewGuid(); var initiatingMessage = new MySagaInitiatingMessage(correlationId) { SomeRandomValue = Guid.NewGuid(), }; saga = new MySaga(); var context = new PipelineContext(initiatingMessage, saga); sut.AfterInitialisation(context); // change time so we can compare dates consumingTime = new DateTime(1955, 7, 13); TimeProvider.Current = new StubTimeProvider(consumingTime); // and throw in another message consumingMessage = new MySagaConsumingMessage(correlationId) { SomeRandomValue = Guid.NewGuid().ToString() }; sut.AfterConsuming(new PipelineContext(consumingMessage, saga)); sagaMetadata = saga.GetSagaMetadata(new JsonNetSerialiser()); }
public void Consumed_PipelineHooks_ExecutedInOrder() { //Arrange var correlationId = Guid.NewGuid(); repository.Save(new MySaga() { CorrelationId = correlationId }); var message = new MySagaConsumingMessage(correlationId); // Act sut.Consume(message); // Assert Received.InOrder(() => { pipelineHook.BeforeConsuming(Arg.Any <PipelineContext>()); pipelineHook.AfterConsuming(Arg.Any <PipelineContext>()); pipelineHook.AfterSave(Arg.Any <PipelineContext>()); }); }