public async Task Handle_is_idempotent( Guid streamId, long startVersion, Event1[] events, string commandId, TracingProperties tracingProperties, MessageBusDouble eventBus) { // Arrange var brokenEventBus = new MessageBusDouble(errors: 1); EntityEventStore <State1> eventStore = GenerateEventStore <State1>(brokenEventBus); await TryCatchIgnore(() => eventStore.CollectEvents(streamId, startVersion, events)); EntityFlushEventsCommandExecutor sut = GenerateSut(eventBus); var command = new FlushEvents(TypeResolver.ResolveTypeName <State1>(), streamId); var message = new Message(id: commandId, data: command, tracingProperties); // Act await sut.Handle(message); await sut.Handle(message); // Assert eventBus.Calls.Should().BeEquivalentTo(brokenEventBus.Calls); }
public void CanHandle_returns_false_for_non_FlushTableEvents_command_message( string id, object data, TracingProperties tracingProperties, IMessageBus eventBus) { var message = new Message(id, data, tracingProperties); EntityFlushEventsCommandExecutor sut = GenerateSut(eventBus); bool actual = sut.CanHandle(message); actual.Should().BeFalse(); }
public void CanHandle_returns_true_for_FlushEntityFrameworkEvents_command_message( string commandId, FlushEvents command, TracingProperties tracingProperties, IMessageBus eventBus) { var message = new Message(id: commandId, data: command, tracingProperties); EntityFlushEventsCommandExecutor sut = GenerateSut(eventBus); bool actual = sut.CanHandle(message); actual.Should().BeTrue(); }