public StopwatchBehavior(StopwatchConfiguration configuration, IRequestInformation <TRequest> requestInformation, IRequestProcessor <TRequest> requestProcessor) { _Configuration = configuration; _RequestInformation = requestInformation; if (!_Configuration.AllowUse) { return; } _RequestProcessor = requestProcessor; _Stopwatch = new System.Diagnostics.Stopwatch(); }
public async Task FactMethodName_IsSuccess_Should_CallProcessMethod() { var configuration = new StopwatchConfiguration(true, 50, 50, 50, 50); var requestProcessor = Mock.Of <IRequestProcessor <TestCommand> >(); var requestInformation = new RequestInformation <TestCommand> { Elapsed = 500 }; IPipelineBehavior <TestCommand, Unit> stopwatchPipeline = new StopwatchBehavior <TestCommand, Unit>( configuration, requestInformation, requestProcessor); var testCommand = new TestCommand(); var testHandler = new TestCommandHandler(); var unit = await stopwatchPipeline.Handle(testCommand,
public RequestProcessor(StopwatchConfiguration configuration, IRequestInformation <TRequest> requestInformation, ILogger <TRequest> logger, IQuickerStopwatchDescriber stopwatchDescriber, IRequestTimeoutDictionary timeoutDictionary) { _RequestInformation = requestInformation; _Logger = logger; _StopwatchDescriber = stopwatchDescriber; _TimeoutDictionary = timeoutDictionary; _DefaultTimeouts = new Dictionary <ERequestType, uint>() { { ERequestType.Command, configuration.DefaultMaxMiliSecondsForCommands }, { ERequestType.Query, configuration.DefaultMaxMiliSecondsForQueries }, { ERequestType.Notification, configuration.DefaultMaxMiliSecondsForNotifications }, { ERequestType.Request, configuration.DefaultMaxMiliSecondsForRequests } }; }