コード例 #1
0
        public void ReceiveRequest_Returns_Null_If_Inner_Channel_Returns_Null()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            innerChannel.RequestContextToReturn = null;
            RequestContext context = channel.ReceiveRequest();

            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.ReceiveRequest should have returned null since the inner channel returned null.");
        }
コード例 #2
0
        public void ReceiveRequest_Calls_ReceiveRequest_On_The_Inner_Channel()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            TimeSpan timeout = new TimeSpan(0, 1, 0);

            innerChannel.RequestContextToReturn = new MockRequestContext();
            RequestContext context = channel.ReceiveRequest(timeout);

            Assert.IsTrue(innerChannel.ReceiveRequestCalled, "HttpMessageEncodingReplyChannel.ReceiveRequest should call ReceiveRequest on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.ReceiveRequest should have passed the timeout parameter to the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.ReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
        }
コード例 #3
0
        public void ReceiveRequest_Returns_Null_If_Inner_Channel_Returns_Null()
        {
            MockChannelListener channelManager = new MockChannelListener();
            MockReplyChannel innerChannel = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);
            channel.Open();

            innerChannel.RequestContextToReturn = null;
            RequestContext context = channel.ReceiveRequest();
            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.ReceiveRequest should have returned null since the inner channel returned null.");
        }
コード例 #4
0
        public void ReceiveRequest_Calls_ReceiveRequest_On_The_Inner_Channel()
        {
            MockChannelListener channelManager = new MockChannelListener();
            MockReplyChannel innerChannel = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);
            channel.Open();

            TimeSpan timeout = new TimeSpan(0, 1, 0);
            innerChannel.RequestContextToReturn = new MockRequestContext();
            RequestContext context = channel.ReceiveRequest(timeout);
            Assert.IsTrue(innerChannel.ReceiveRequestCalled, "HttpMessageEncodingReplyChannel.ReceiveRequest should call ReceiveRequest on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.ReceiveRequest should have passed the timeout parameter to the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.ReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
        }