public async Task InvokeManyCommands_no_exception_if_commands_is_null() { IEnumerable <TestCommand> commands = null; await BusExtensions.InvokeManyCommands(mockBus.Object, commands); mockBus.Verify(p => p.InvokeCommand(It.IsAny <TestCommand>()), Times.Never); }
public async Task InvokeManyCommands_forwards_to_IBus() { var commands = fixture.CreateMany <TestCommand>().ToArray(); await BusExtensions.InvokeManyCommands(mockBus.Object, commands); mockBus.Verify(p => p.InvokeCommand(It.IsAny <TestCommand>()), Times.Exactly(commands.Length)); }
public async Task RaiseManyEvents_CorrelationId_Bus_is_required() { var events = fixture.CreateMany <TestEvent>().ToArray(); var correlationId = fixture.Create <Guid>(); await BusExtensions.RaiseManyEvents(null, events, correlationId); }
public async Task RaiseManyEvents_no_exception_if_commands_is_null() { IEnumerable <TestEvent> events = null; await BusExtensions.RaiseManyEvents(mockBus.Object, events); mockBus.Verify(p => p.RaiseEvent(It.IsAny <TestEvent>()), Times.Never); }
public async Task InvokeManyCommands_CorrelationId_Bus_is_required() { var commands = fixture.CreateMany <TestCommand>().ToArray(); var correlationId = fixture.Create <Guid>(); await BusExtensions.InvokeManyCommands(null, commands, correlationId); }
public async Task RaiseManyEvents_forwards_to_IBus() { var events = fixture.CreateMany <TestEvent>().ToArray(); await BusExtensions.RaiseManyEvents(mockBus.Object, events); mockBus.Verify(p => p.RaiseEvent(It.IsAny <TestEvent>()), Times.Exactly(events.Length)); }
public async Task InvokeManyCommands_CorrelationId_no_exception_if_commands_is_null() { IEnumerable <TestCommand> commands = null; var correlationId = fixture.Create <Guid>(); await BusExtensions.InvokeManyCommands(mockBus.Object, commands, correlationId); mockBus.Verify(p => p.InvokeCommand(It.IsAny <TestCommand>()), Times.Never); }
public async Task RaiseManyEvents_CorrelationId_no_exception_if_commands_is_null() { IEnumerable <TestEvent> events = null; var correlationId = fixture.Create <Guid>(); await BusExtensions.RaiseManyEvents(mockBus.Object, events, correlationId); mockBus.Verify(p => p.RaiseEvent(It.IsAny <TestEvent>(), It.IsAny <Guid>()), Times.Never); }
public static IDisposable SubscribeToAndUpdate <TMessage, TEntity>(this ObservableMessageBus source, Action <TEntity, TMessage> onNext, IEventRepository repo) where TMessage : class, IMessage <IEventSourcedEntityCommand> where TEntity : class, IEventSourcedEntity { async Task a(TMessage obj) { var ent = await repo.GetAsync <TEntity>(obj.Body.Id); onNext(ent, obj); await repo.SaveAsync(ent); } return(BusExtensions.SubscribeTo <TMessage>(source) .Select(x => Observable.FromAsync(() => a(x))) .Concat() .Subscribe()); }
public void InvokeCommandAsync_requires_bus(FirstTestCommand testCommand, Guid correlationId) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.InvokeCommandAsync(null, testCommand, correlationId)); }
public async Task RaiseManyEventsAsync_handles_null_event_list(IBus bus, Guid correlationId, IDictionary <string, string> headers) { await BusExtensions.RaiseManyEventsAsync <FirstTestEvent>(bus, null, correlationId, headers); Mock.Get(bus).Verify(p => p.RaiseEventAsync(It.IsAny <FirstTestEvent>(), It.IsAny <Guid>(), headers), Times.Never); }
public async Task InvokeCommandAsync_forwards_to_bus(IBus bus, FirstTestCommand testCommand, IDictionary <string, string> headers) { await BusExtensions.InvokeCommandAsync(bus, testCommand, headers); Mock.Get(bus).Verify(p => p.InvokeCommandAsync(testCommand, It.IsAny <Guid>(), headers)); }
public async Task InvokeCommandAsync_forwards_to_bus(IBus bus, FirstTestCommand testCommand, Guid correlationId) { await BusExtensions.InvokeCommandAsync(bus, testCommand, correlationId); Mock.Get(bus).Verify(p => p.InvokeCommandAsync(testCommand, correlationId, It.IsAny <IDictionary <string, string> >())); }
public void RaiseManyEventsAsync_requires_bus(FirstTestEvent[] testEvents, Guid correlationId, IDictionary <string, string> headers) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.RaiseManyEventsAsync(null, testEvents, correlationId, headers)); }
public async Task RaiseManyEventsAsync_forwards_all_to_bus(IBus bus, FirstTestEvent[] testEvents, Guid correlationId, IDictionary <string, string> headers) { await BusExtensions.RaiseManyEventsAsync(bus, testEvents, correlationId, headers); Mock.Get(bus).Verify(p => p.RaiseEventAsync(It.IsAny <FirstTestEvent>(), correlationId, headers), Times.Exactly(testEvents.Length)); }
public void RaiseManyEventsAsync_requires_bus(FirstTestEvent[] testEvents) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.RaiseManyEventsAsync(null, testEvents)); }
public async Task RaiseManyEvents_Bus_is_required() { var events = fixture.CreateMany <TestEvent>().ToArray(); await BusExtensions.RaiseManyEvents(null, events); }
public void RaiseEventAsync_requires_bus(FirstTestEvent testEvent, IDictionary <string, string> headers) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.RaiseEventAsync(null, testEvent, headers)); }
public async Task RaiseEventAsync_forwards_to_bus(IBus bus, FirstTestEvent testEvent, IDictionary <string, string> headers) { await BusExtensions.RaiseEventAsync(bus, testEvent, headers); Mock.Get(bus).Verify(p => p.RaiseEventAsync(testEvent, It.IsAny <Guid>(), headers)); }
public void InvokeCommandAsync_requires_bus(FirstTestCommand testCommand, IDictionary <string, string> headers) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.InvokeCommandAsync(null, testCommand, headers)); }
public async Task InvokeManyCommands_Bus_is_required() { var commands = fixture.CreateMany <TestCommand>().ToArray(); await BusExtensions.InvokeManyCommands(null, commands); }
public async Task RaiseEventAsync_forwards_to_bus(IBus bus, FirstTestEvent testEvent, Guid correlationId) { await BusExtensions.RaiseEventAsync(bus, testEvent, correlationId); Mock.Get(bus).Verify(p => p.RaiseEventAsync(testEvent, correlationId, It.IsAny <IDictionary <string, string> >())); }
public void InvokeManyCommandsAsync_requires_bus(FirstTestCommand[] testCommands) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.InvokeManyCommandsAsync(null, testCommands)); }
public void RaiseEventAsync_requires_bus(FirstTestEvent testEvent, Guid correlationId) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.RaiseEventAsync(null, testEvent, correlationId)); }
public void InvokeManyCommandsAsync_requires_bus(FirstTestCommand[] testCommands, Guid correlationId, IDictionary <string, string> headers) { Assert.ThrowsAsync <ArgumentNullException>(() => BusExtensions.InvokeManyCommandsAsync(null, testCommands, correlationId, headers)); }
public async Task InvokeManyCommandsAsync_forwards_all_to_bus(IBus bus, FirstTestCommand[] testCommands) { await BusExtensions.InvokeManyCommandsAsync(bus, testCommands); Mock.Get(bus).Verify(p => p.InvokeCommandAsync(It.IsAny <FirstTestCommand>(), It.IsAny <Guid>(), It.IsAny <IDictionary <string, string> >()), Times.Exactly(testCommands.Length)); }
public async Task InvokeManyCommandsAsync_handles_null_command_list(IBus bus, Guid correlationId, IDictionary <string, string> headers) { await BusExtensions.InvokeManyCommandsAsync <FirstTestCommand>(bus, null, correlationId, headers); Mock.Get(bus).Verify(p => p.InvokeCommandAsync(It.IsAny <FirstTestCommand>(), It.IsAny <Guid>(), It.IsAny <IDictionary <string, string> >()), Times.Never); }