public void CanBuildChannelListener() { MsmqTransportBindingElement be = new MsmqTransportBindingElement(); 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.IsTrue(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.IsTrue(be.CanBuildChannelListener <IInputSessionChannel> (ctx), "#8"); // IServiceChannel is not supported Assert.IsFalse(be.CanBuildChannelListener <IServiceChannel> (ctx), "#9"); }
public static void Snippet10() { BinaryMessageEncodingBindingElement encodingBindingElement = new BinaryMessageEncodingBindingElement(); MsmqTransportBindingElement transportBindingElement = new MsmqTransportBindingElement(); CustomBinding binding = new CustomBinding(encodingBindingElement, transportBindingElement); BindingParameterCollection bindingParams = new BindingParameterCollection(); BindingContext context = new BindingContext(binding, bindingParams); // <Snippet10> if (transportBindingElement.CanBuildChannelListener <IInputChannel>(context)) { // Do something... } // </Snippet10> }
public void CanBuildChannelListener () { MsmqTransportBindingElement be = new MsmqTransportBindingElement (); 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.IsTrue (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.IsTrue (be.CanBuildChannelListener<IInputSessionChannel> (ctx), "#8"); // IServiceChannel is not supported Assert.IsFalse (be.CanBuildChannelListener<IServiceChannel> (ctx), "#9"); }