public void Abort_Calls_Abort_On_The_Inner_Channel()
        {
            MockChannelListener channelManager = new MockChannelListener();
            MockReplyChannel innerChannel = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);
            channel.Open();

            channel.Abort();
            Assert.IsTrue(innerChannel.OnAbortCalled, "HttpMessageEncodingReplyChannel.Abort should call Abort on the inner channel.");
        }
예제 #2
0
        public void Abort_Calls_Abort_On_The_Inner_Channel()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            channel.Abort();
            Assert.IsTrue(innerChannel.OnAbortCalled, "HttpMessageEncodingReplyChannel.Abort should call Abort on the inner channel.");
        }
        public void BeginClose_Calls_BeginClose_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.BeginClose(timeout, null, null);
            Assert.IsTrue(innerChannel.OnBeginCloseCalled, "HttpMessageEncodingReplyChannel.BeginClose should call BeginClose on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.BeginClose should have passed the timeout parameter to the inner channel.");
        }
예제 #4
0
        public void EndClose_Calls_EndClose_On_The_Inner_Channel()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            IAsyncResult result = channel.BeginClose(null, null);

            channel.EndClose(result);
            Assert.IsTrue(innerChannel.OnEndCloseCalled, "HttpMessageEncodingReplyChannel.EndClose should call EndClose on the inner channel.");
        }
예제 #5
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.");
        }
        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.");
        }
예제 #7
0
        public void BeginClose_Calls_BeginClose_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.BeginClose(timeout, null, null);

            Assert.IsTrue(innerChannel.OnBeginCloseCalled, "HttpMessageEncodingReplyChannel.BeginClose should call BeginClose on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.BeginClose should have passed the timeout parameter to the inner channel.");
        }
예제 #8
0
        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.");
        }
예제 #9
0
        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.");
        }
예제 #10
0
        public void WaitForRequest_Calls_WaitForRequest_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);
            bool     didRecievedRequest = channel.WaitForRequest(timeout);

            Assert.IsTrue(innerChannel.WaitForRequestCalled, "HttpMessageEncodingReplyChannel.WaitForRequest should call WaitForRequest on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.WaitForRequest should have passed the timeout parameter to the inner channel.");
            Assert.IsFalse(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndWaitForRequest should have returned the value returned from the inner channel.");
        }
예제 #11
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.");
        }
예제 #12
0
        public void EndTryReceiveRequest_Returns_Null_If_The_Inner_Channel_Returns_False()
        {
            MockChannelListener             channelManager = new MockChannelListener();
            MockReplyChannel                innerChannel   = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel        = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);

            channel.Open();

            innerChannel.RequestContextToReturn       = new MockRequestContext();
            innerChannel.TryReceiveRequestReturnsTrue = false;
            IAsyncResult   result = channel.BeginTryReceiveRequest(new TimeSpan(0, 1, 0), null, null);
            RequestContext context;
            bool           didRecievedRequest = channel.EndTryReceiveRequest(result, out context);

            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should have returned null since the inner channel returned false.");
        }
예제 #13
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.");
        }
예제 #14
0
        public void EndTryReceiveRequest_Calls_EndTryReceiveRequest_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();
            innerChannel.TryReceiveRequestReturnsTrue = true;
            IAsyncResult   result = channel.BeginTryReceiveRequest(new TimeSpan(0, 1, 0), null, null);
            RequestContext context;
            bool           didRecievedRequest = channel.EndTryReceiveRequest(result, out context);

            Assert.IsTrue(innerChannel.EndTryReceiveRequestCalled, "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should call EndTryReceiveRequest on the inner channel.");
            Assert.IsTrue(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should have returned the value returned from the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
        }
예제 #15
0
        public void TryReceiveRequest_Returns_Null_If_Inner_Channel_Returns_False()
        {
            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();
            innerChannel.TryReceiveRequestReturnsTrue = false;
            RequestContext context;
            bool           didRecievedRequest = channel.TryReceiveRequest(timeout, out context);

            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.TryReceiveRequest should have returned null since the inner channel returned false.");
            Assert.IsFalse(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndWaitForRequest should have returned the value returned from the inner channel.");
        }
        public void EndClose_Calls_EndClose_On_The_Inner_Channel()
        {
            MockChannelListener channelManager = new MockChannelListener();
            MockReplyChannel innerChannel = new MockReplyChannel(channelManager);
            HttpMessageEncodingReplyChannel channel = new HttpMessageEncodingReplyChannel(channelManager, innerChannel);
            channel.Open();

            IAsyncResult result = channel.BeginClose(null, null);
            channel.EndClose(result);
            Assert.IsTrue(innerChannel.OnEndCloseCalled, "HttpMessageEncodingReplyChannel.EndClose should call EndClose on the inner channel.");
        }
        public void WaitForRequest_Calls_WaitForRequest_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);
            bool didRecievedRequest = channel.WaitForRequest(timeout);
            Assert.IsTrue(innerChannel.WaitForRequestCalled, "HttpMessageEncodingReplyChannel.WaitForRequest should call WaitForRequest on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.WaitForRequest should have passed the timeout parameter to the inner channel.");
            Assert.IsFalse(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndWaitForRequest should have returned the value returned from the inner channel.");
        }
        public void TryReceiveRequest_Returns_Null_If_Inner_Channel_Returns_Null()
        {
            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 = null;
            innerChannel.TryReceiveRequestReturnsTrue = true;
            RequestContext context;
            bool didRecievedRequest = channel.TryReceiveRequest(timeout, out context);
            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.TryReceiveRequest should have returned null since the inner channel returned null.");
            Assert.IsTrue(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndWaitForRequest should have returned the value returned from the inner channel.");
        }
        public void TryReceiveRequest_Calls_TryReceiveRequest_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();
            innerChannel.TryReceiveRequestReturnsTrue = true;
            RequestContext context;
            bool didRecievedRequest = channel.TryReceiveRequest(timeout, out context);
            Assert.IsTrue(innerChannel.TryReceiveRequestCalled, "HttpMessageEncodingReplyChannel.TryReceiveRequest should call TryReceiveRequest on the inner channel.");
            Assert.AreEqual(timeout, innerChannel.TimeoutParameter, "HttpMessageEncodingReplyChannel.TryReceiveRequest should have passed the timeout parameter to the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.ReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
            Assert.IsTrue(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndWaitForRequest should have returned the value returned from the inner channel.");
        }
        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.");
        }
        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 EndTryReceiveRequest_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;
            innerChannel.TryReceiveRequestReturnsTrue = true;
            IAsyncResult result = channel.BeginTryReceiveRequest(new TimeSpan(0, 1, 0), null, null);
            RequestContext context;
            bool didRecievedRequest = channel.EndTryReceiveRequest(result, out context);
            Assert.IsNull(context, "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should have returned null since the inner channel returned null.");
        }
        public void EndTryReceiveRequest_Calls_EndTryReceiveRequest_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();
            innerChannel.TryReceiveRequestReturnsTrue = true;
            IAsyncResult result = channel.BeginTryReceiveRequest(new TimeSpan(0, 1, 0), null, null);
            RequestContext context;
            bool didRecievedRequest = channel.EndTryReceiveRequest(result, out context);
            Assert.IsTrue(innerChannel.EndTryReceiveRequestCalled, "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should call EndTryReceiveRequest on the inner channel.");
            Assert.IsTrue(didRecievedRequest, "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should have returned the value returned from the inner channel.");
            Assert.IsInstanceOfType(context, typeof(HttpMessageEncodingRequestContext), "HttpMessageEncodingReplyChannel.EndTryReceiveRequest should have returned an HttpMessageEncodingRequestContext instance.");
        }
        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.");
        }