Beispiel #1
0
        public static void Snippet9()
        {
            BinaryMessageEncodingBindingElement encodingBindingElement  = new BinaryMessageEncodingBindingElement();
            MsmqTransportBindingElement         transportBindingElement = new MsmqTransportBindingElement();
            CustomBinding binding = new CustomBinding(encodingBindingElement, transportBindingElement);
            BindingParameterCollection bindingParams = new BindingParameterCollection();
            BindingContext             context       = new BindingContext(binding, bindingParams);

            // <Snippet9>
            if (transportBindingElement.CanBuildChannelFactory <IOutputChannel>(context))
            {
                // Do something...
            }
            // </Snippet9>
        }
        public void CanBuildChannelFactory()
        {
            MsmqTransportBindingElement be =
                new MsmqTransportBindingElement();
            BindingContext ctx = new BindingContext(
                new CustomBinding(), empty_params);

            Assert.IsFalse(be.CanBuildChannelFactory <IRequestChannel> (ctx), "#1");
            Assert.IsFalse(be.CanBuildChannelFactory <IInputChannel> (ctx), "#2");
            Assert.IsFalse(be.CanBuildChannelFactory <IReplyChannel> (ctx), "#3");
            Assert.IsTrue(be.CanBuildChannelFactory <IOutputChannel> (ctx), "#4");
            Assert.IsFalse(be.CanBuildChannelFactory <IRequestSessionChannel> (ctx), "#5");
            Assert.IsFalse(be.CanBuildChannelFactory <IInputSessionChannel> (ctx), "#6");
            Assert.IsFalse(be.CanBuildChannelFactory <IReplySessionChannel> (ctx), "#7");
            Assert.IsTrue(be.CanBuildChannelFactory <IOutputSessionChannel> (ctx), "#8");

            // IServiceChannel is not supported
            Assert.IsFalse(be.CanBuildChannelListener <IServiceChannel> (ctx), "#9");
        }
		public void CanBuildChannelFactory ()
		{
			MsmqTransportBindingElement be =
				new MsmqTransportBindingElement ();
			BindingContext ctx = new BindingContext (
				new CustomBinding (), empty_params);
			Assert.IsFalse (be.CanBuildChannelFactory<IRequestChannel> (ctx), "#1");
			Assert.IsFalse (be.CanBuildChannelFactory<IInputChannel> (ctx), "#2");
			Assert.IsFalse (be.CanBuildChannelFactory<IReplyChannel> (ctx), "#3");
			Assert.IsTrue (be.CanBuildChannelFactory<IOutputChannel> (ctx), "#4");
			Assert.IsFalse (be.CanBuildChannelFactory<IRequestSessionChannel> (ctx), "#5");
			Assert.IsFalse (be.CanBuildChannelFactory<IInputSessionChannel> (ctx), "#6");
			Assert.IsFalse (be.CanBuildChannelFactory<IReplySessionChannel> (ctx), "#7");
			Assert.IsTrue (be.CanBuildChannelFactory<IOutputSessionChannel> (ctx), "#8");

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