Пример #1
0
        public async Task AsyncRequestResponseMessagePipelineShouldFireHandlers()
        {
            var preRequestHandledCount = 0;
            var postRequestHandledCount = 0;
            var handled = false;
            var message = new TestAsyncRequestResponseMessage
            {
                PreRequestAction = () =>
                {
                    preRequestHandledCount++;
                },
                HandlerAction = () =>
                {
                    handled = true;
                },
                PostRequestAction = () =>
                {
                    postRequestHandledCount++;
                }
            };

            await _dispatcher.HandleAsync<TestAsyncRequestResponseMessage, string>(message);
            preRequestHandledCount.ShouldBe(3);
            postRequestHandledCount.ShouldBe(3);
            handled.ShouldBe(true);
        }
Пример #2
0
 public void ShouldHandleAsyncRequestResponse()
 {
     var message = new TestAsyncRequestResponseMessage { Data = "before" };
     _dispatcher.HandleAsync<TestAsyncRequestResponseMessage, string>(message).Result.ShouldBe("handled");
 }