示例#1
0
        public void BuildChannelListener_Returns_ChannelListener_For_IReplyChannel()
        {
            HttpMessageHandlerBindingElement bindingElement = new HttpMessageHandlerBindingElement();
            IChannelListener <IReplyChannel> listener       = bindingElement.BuildChannelListener <IReplyChannel>(MockBindingContext.Create());

            Assert.IsNotNull(listener, "HttpMessageHandlerBindingElement.BuildChannelListener should have returned an instance.");
            Assert.IsInstanceOfType(listener, typeof(HttpMessageHandlerChannelListener), "HttpMessageHandlerBindingElement.BuildChannelListener should have returned an HttpMessageHandlerChannelListener.");
        }
 public void HttpMessagePluginBindingElement_Method7()
 {
     var be      = new HttpMessageHandlerBindingElement();
     var bc      = new BindingContext(new CustomBinding(be), new BindingParameterCollection());
     var channel = be.BuildChannelListener <IInputChannel>(bc);
 }
示例#3
0
        public void BuildChannelListener_Throws_For_Non_IReplyChannel()
        {
            HttpMessageHandlerBindingElement bindingElement = new HttpMessageHandlerBindingElement();

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IReplySessionChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IReplySessionChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IRequestChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IRequestChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IRequestSessionChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IRequestSessionChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IOutputChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IOutputChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IOutputSessionChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IOutputSessionChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IInputChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IInputChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IInputSessionChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IInputSessionChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IDuplexChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IDuplexChannel>(MockBindingContext.Create());
            });

            ExceptionAssert.Throws <NotSupportedException>(
                SR.HttpMessageHandlerChannelInvalidChannelShape(typeof(IDuplexSessionChannel).Name, typeof(HttpMessageHandlerBindingElement).Name, typeof(IReplyChannel).Name),
                () =>
            {
                bindingElement.BuildChannelListener <IDuplexSessionChannel>(MockBindingContext.Create());
            });
        }