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."); }
public void BeginReceiveRequest_Calls_BeginReceiveRequest_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); IAsyncResult result = channel.BeginReceiveRequest(timeout, null, null); Assert.IsTrue(innerChannel.BeginReceiveRequestCalled, "HttpMessageEncodingReplyChannel.BeginReceiveRequest should call BeginReceiveRequest on the inner channel."); Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.BeginReceiveRequest should have passed the timeout parameter to the inner channel."); Assert.AreSame(innerChannel.AsyncResultReturned, result, "HttpMessageEncodingReplyChannel.BeginReceiveRequest should have returned the async result from the inner channel."); }