public void EndWaitForRequest_Calls_EndWaitForRequest_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.BeginWaitForRequest(new TimeSpan(0, 1, 0), null, null); bool didRecievedRequest = channel.EndWaitForRequest(result); Assert.IsTrue(innerChannel.EndWaitForRequestCalled, "HttpMessageEncodingReplyChannel.EndWaitForRequest should call EndWaitForRequest on the inner channel."); Assert.IsFalse(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndWaitForRequest should have returned the value returned from the inner channel."); }
public void BeginWaitForRequest_Calls_BeginWaitForRequest_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.BeginWaitForRequest(timeout, null, null); Assert.IsTrue(innerChannel.BeginWaitForRequestCalled, "HttpMessageEncodingReplyChannel.BeginWaitForRequest should call BeginWaitForRequest on the inner channel."); Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.BeginWaitForRequest should have passed the timeout parameter to the inner channel."); Assert.AreSame(innerChannel.AsyncResultReturned, result, "HttpMessageEncodingReplyChannel.BeginWaitForRequest should have returned the async result from the inner channel."); }