public async Task Continues_to_execution_if_handler_resolved() { // Arrange _resolver.Resolve <IHandleCommand <TestCommand> >().Returns(_handler); // Act var dispatcher = CreateDispatcher(); var command = new TestCommand(); await dispatcher.CommandAsync(command); // Assert _resolver.Received(1).Resolve <IHandleCommand <TestCommand> >(); await _executor.Received(1).ExecuteAsync(_handler, command, CancellationToken.None); }
public async Task Continues_to_execution_if_handler_resolved() { // Arrange var handlers = new List <IHandleEvent <TestEvent> > { _handler }; _resolver.ResolveAll <IHandleEvent <TestEvent> >().Returns(handlers); // Act var dispatcher = CreateDispatcher(); var evnt = new TestEvent(); await dispatcher.PublishAsync(evnt); // Assert _resolver.Received(1).ResolveAll <IHandleEvent <TestEvent> >(); await _executor.Received(1).ExecuteAsync(handlers, evnt, CancellationToken.None); }