async Task WhenTheCommandIsHandled() { var cmd = new TestBaseCommand(Guid.NewGuid()); var context = new ReceiveContext <TestBaseCommand>(cmd); var console1 = new EmptyPipeSpecification <IReceiveContext <TestBaseCommand> >(); var console2 = new EmptyPipeSpecification <IReceiveContext <TestBaseCommand> >(); await console1.BeforeExecute(context, default(CancellationToken)); await console2.BeforeExecute(context, default(CancellationToken)); await _handler.Handle(new ReceiveContext <TestBaseCommand>(cmd), default(CancellationToken)); await console1.AfterExecute(context, default(CancellationToken)); await console2.AfterExecute(context, default(CancellationToken)); _sw.Stop(); Console.WriteLine($"It took {_sw.ElapsedMilliseconds} milliseconds"); }
public async Task WhenTheCommandIsHandled() { var cmd = new TestBaseCommand(Guid.NewGuid()); var context = new ReceiveContext <TestBaseCommand>(cmd); var console1 = new EmptyPipeSpecification <IReceiveContext <TestBaseCommand> >(); var console2 = new EmptyPipeSpecification <IReceiveContext <TestBaseCommand> >(); await console1.ExecuteBeforeConnect(context); await console2.ExecuteBeforeConnect(context); await _handler.Handle(new ReceiveContext <TestBaseCommand>(cmd)); await console1.ExecuteAfterConnect(context); await console2.ExecuteAfterConnect(context); _sw.Stop(); Console.WriteLine($"It took {_sw.ElapsedMilliseconds} milliseconds"); }