Пример #1
0
        public void EndReceiveRequest_Returns_Null_If_The_Inner_Channel_Returns_Null()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            innerChannel.RequestContextToReturn = null;
            IAsyncResult   result  = channel.BeginReceiveRequest(null, null);
            RequestContext context = channel.EndReceiveRequest(result);

            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.EndReceiveRequest should have returned null since the inner channel returned null.");
        }
Пример #2
0
        public void EndReceiveRequest_Calls_EndReceiveRequest_On_The_Inner_Channel()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            innerChannel.RequestContextToReturn = new MockRequestContext();
            IAsyncResult   result  = channel.BeginReceiveRequest(null, null);
            RequestContext context = channel.EndReceiveRequest(result);

            Assert.IsTrue(innerChannel.EndReceiveRequestCalled, "HttpMessageEncodingReplyChannel.EndReceiveRequest should call EndReceiveRequest on the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.EndReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
        }
        public void EndReceiveRequest_Returns_Null_If_The_Inner_Channel_Returns_Null()
        {
            MockChannelListener channelManager = new MockChannelListener();
            MockReplyChannel innerChannel = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);
            channel.Open();

            innerChannel.RequestContextToReturn = null;
            IAsyncResult result = channel.BeginReceiveRequest(null, null);
            RequestContext context = channel.EndReceiveRequest(result);
            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.EndReceiveRequest should have returned null since the inner channel returned null.");
        }
        public void EndReceiveRequest_Calls_EndReceiveRequest_On_The_Inner_Channel()
        {
            MockChannelListener channelManager = new MockChannelListener();
            MockReplyChannel innerChannel = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);
            channel.Open();

            innerChannel.RequestContextToReturn = new MockRequestContext();
            IAsyncResult result = channel.BeginReceiveRequest(null, null);
            RequestContext context = channel.EndReceiveRequest(result);
            Assert.IsTrue(innerChannel.EndReceiveRequestCalled, "HttpMessageEncodingReplyChannel.EndReceiveRequest should call EndReceiveRequest on the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.EndReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
        }