public void CanBuildChannelListener()
        {
            // with HttpTransport
            var m = new WebMessageEncodingBindingElement();

            Assert.IsFalse(m.CanBuildChannelListener <IRequestChannel> (CreateBindingContext()), "#1");
            Assert.IsTrue(m.CanBuildChannelListener <IReplyChannel> (CreateBindingContext()), "#2");
            Assert.IsFalse(m.CanBuildChannelListener <IRequestSessionChannel> (CreateBindingContext()), "#3");
            Assert.IsFalse(m.CanBuildChannelListener <IDuplexChannel> (CreateBindingContext()), "#4");

            // actually they are from transport
            var h = new HttpTransportBindingElement();

            Assert.IsFalse(h.CanBuildChannelListener <IRequestChannel> (CreateBindingContext()), "#5");
            Assert.IsTrue(h.CanBuildChannelListener <IReplyChannel> (CreateBindingContext()), "#6");
            Assert.IsFalse(h.CanBuildChannelListener <IRequestSessionChannel> (CreateBindingContext()), "#7");
            Assert.IsFalse(h.CanBuildChannelListener <IDuplexChannel> (CreateBindingContext()), "#8");

            // with TcpTransport
            Assert.IsFalse(m.CanBuildChannelListener <IRequestChannel> (CreateBindingContext2()), "#9");
            Assert.IsFalse(m.CanBuildChannelListener <IReplyChannel> (CreateBindingContext2()), "#10");
            Assert.IsFalse(m.CanBuildChannelListener <IRequestSessionChannel> (CreateBindingContext2()), "#11");
            Assert.IsFalse(m.CanBuildChannelListener <IDuplexChannel> (CreateBindingContext2()), "#12");

            // ... yes, actually they are from transport
            var t = new TcpTransportBindingElement();

            Assert.IsFalse(t.CanBuildChannelListener <IRequestChannel> (CreateBindingContext2()), "#13");
            Assert.IsFalse(t.CanBuildChannelListener <IReplyChannel> (CreateBindingContext2()), "#14");
            Assert.IsFalse(t.CanBuildChannelListener <IRequestSessionChannel> (CreateBindingContext2()), "#15");
            Assert.IsFalse(t.CanBuildChannelListener <IDuplexChannel> (CreateBindingContext2()), "#16");
        }
		public void CanBuildChannelListener ()
		{
			TcpTransportBindingElement be =
				new TcpTransportBindingElement ();
			BindingContext ctx = new BindingContext (
				new CustomBinding (), empty_params);
			Assert.IsFalse (be.CanBuildChannelListener<IReplyChannel> (ctx), "#1");
			Assert.IsFalse (be.CanBuildChannelListener<IOutputChannel> (ctx), "#2");
			Assert.IsFalse (be.CanBuildChannelListener<IRequestChannel> (ctx), "#3");
			Assert.IsFalse (be.CanBuildChannelListener<IInputChannel> (ctx), "#4");

			Assert.IsFalse (be.CanBuildChannelListener<IReplySessionChannel> (ctx), "#5");
			Assert.IsFalse (be.CanBuildChannelListener<IOutputSessionChannel> (ctx), "#6");
			Assert.IsFalse (be.CanBuildChannelListener<IRequestSessionChannel> (ctx), "#7");
			Assert.IsFalse (be.CanBuildChannelListener<IInputSessionChannel> (ctx), "#8");

			// IServiceChannel is not supported
			Assert.IsFalse (be.CanBuildChannelListener<IServiceChannel> (ctx), "#9");
			Assert.IsFalse (be.CanBuildChannelListener<IClientChannel> (ctx), "#10");

			Assert.IsFalse (be.CanBuildChannelListener<IDuplexChannel> (ctx), "#11");
			Assert.IsTrue (be.CanBuildChannelListener<IDuplexSessionChannel> (ctx), "#12");
		}
		public void CanBuildChannelListener ()
		{
			// with HttpTransport
			var m = new WebMessageEncodingBindingElement ();
			Assert.IsFalse (m.CanBuildChannelListener<IRequestChannel> (CreateBindingContext ()), "#1");
			Assert.IsTrue (m.CanBuildChannelListener<IReplyChannel> (CreateBindingContext ()), "#2");
			Assert.IsFalse (m.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext ()), "#3");
			Assert.IsFalse (m.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext ()), "#4");

			// actually they are from transport
			var h = new HttpTransportBindingElement ();
			Assert.IsFalse (h.CanBuildChannelListener<IRequestChannel> (CreateBindingContext ()), "#5");
			Assert.IsTrue  (h.CanBuildChannelListener<IReplyChannel> (CreateBindingContext ()), "#6");
			Assert.IsFalse (h.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext ()), "#7");
			Assert.IsFalse (h.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext ()), "#8");

			// with TcpTransport
			Assert.IsFalse (m.CanBuildChannelListener<IRequestChannel> (CreateBindingContext2 ()), "#9");
			Assert.IsFalse (m.CanBuildChannelListener<IReplyChannel> (CreateBindingContext2 ()), "#10");
			Assert.IsFalse (m.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext2 ()), "#11");
			Assert.IsFalse (m.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext2 ()), "#12");

			// ... yes, actually they are from transport
			var t = new TcpTransportBindingElement ();
			Assert.IsFalse (t.CanBuildChannelListener<IRequestChannel> (CreateBindingContext2 ()), "#13");
			Assert.IsFalse (t.CanBuildChannelListener<IReplyChannel> (CreateBindingContext2 ()), "#14");
			Assert.IsFalse (t.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext2 ()), "#15");
			Assert.IsFalse (t.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext2 ()), "#16");
		}
        public void CanBuildChannelListener2()
        {
            TcpTransportBindingElement be =
                new TcpTransportBindingElement();

            be.TransferMode = TransferMode.Streamed;
            BindingContext ctx = new BindingContext(
                new CustomBinding(), empty_params);

            Assert.IsTrue(be.CanBuildChannelListener <IReplyChannel> (ctx), "#1");
            Assert.IsFalse(be.CanBuildChannelListener <IOutputChannel> (ctx), "#2");
            Assert.IsFalse(be.CanBuildChannelListener <IRequestChannel> (ctx), "#3");
            Assert.IsFalse(be.CanBuildChannelListener <IInputChannel> (ctx), "#4");

            Assert.IsFalse(be.CanBuildChannelListener <IReplySessionChannel> (ctx), "#5");
            Assert.IsFalse(be.CanBuildChannelListener <IOutputSessionChannel> (ctx), "#6");
            Assert.IsFalse(be.CanBuildChannelListener <IRequestSessionChannel> (ctx), "#7");
            Assert.IsFalse(be.CanBuildChannelListener <IInputSessionChannel> (ctx), "#8");

            // IServiceChannel is not supported
            Assert.IsFalse(be.CanBuildChannelListener <IServiceChannel> (ctx), "#9");
            Assert.IsFalse(be.CanBuildChannelListener <IClientChannel> (ctx), "#10");

            Assert.IsFalse(be.CanBuildChannelListener <IDuplexChannel> (ctx), "#11");
            Assert.IsFalse(be.CanBuildChannelListener <IDuplexSessionChannel> (ctx), "#12");
        }