public void BuildChannelListener_Returns_ChannelListener_For_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); IChannelListener<IReplyChannel> listener = encoding.BuildChannelListener<IReplyChannel>(MockBindingContext.Create()); Assert.IsNotNull(listener, "HttpMessageEncodingBindingElement.BuildChannelListener should have returned an instance."); Assert.IsInstanceOfType(listener, typeof(HttpMessageEncodingChannelListener), "HttpMessageEncodingBindingElement.BuildChannelListener should have returned an HttpMessageEncodingChannelListener."); }
public void BuildChannelListener_Adds_HttpMessageEncodingBindingElement_To_Binding_Parameters_Collection() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); MockBindingContext context = MockBindingContext.CreateWithMockTransport(); encoding.BuildChannelListener<IReplyChannel>(context); Assert.IsTrue(context.MockTransportBindingElement.FoundHttpMessageEncodingBindingElement, "The HttpMessageEncodingBindingElement should have been added to the collection of binding parameters."); }
public void BuildChannelListener_Returns_Null_If_Inner_BindingElement_Returns_Null() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); MockBindingContext context = MockBindingContext.CreateWithMockTransport(); IChannelListener<IReplyChannel> listener = encoding.BuildChannelListener<IReplyChannel>(context); Assert.IsNull(listener, "HttpMessageEncodingBindingElement.BuildChannelListener should have null since the inner binding element returned null."); }
public void CreateMessageEncoderFactory_Returns_An_HttpMessageEncoderFactory() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); MessageEncoderFactory encoderFactory = encoding.CreateMessageEncoderFactory(); Assert.IsNotNull(encoderFactory, "HttpMessageEncodingBindingElement.CreateMessageEncoderFactory should not have returned null."); Assert.IsInstanceOfType(encoderFactory, typeof(HttpMessageEncoderFactory), "HttpMessageEncodingBindingElement.CreateMessageEncoderFactory should have returned an instance of a HttpMessageEncoderFactory."); }
public void BuildChannelListener_Adds_HttpMessageEncodingBindingElement_To_Binding_Parameters_Collection() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); MockBindingContext context = MockBindingContext.CreateWithMockTransport(); encoding.BuildChannelListener <IReplyChannel>(context); Assert.IsTrue(context.MockTransportBindingElement.FoundHttpMessageEncodingBindingElement, "The HttpMessageEncodingBindingElement should have been added to the collection of binding parameters."); }
public void BuildChannelListener_Returns_Null_If_Inner_BindingElement_Returns_Null() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); MockBindingContext context = MockBindingContext.CreateWithMockTransport(); IChannelListener <IReplyChannel> listener = encoding.BuildChannelListener <IReplyChannel>(context); Assert.IsNull(listener, "HttpMessageEncodingBindingElement.BuildChannelListener should have null since the inner binding element returned null."); }
public void BuildChannelListener_Returns_ChannelListener_For_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); IChannelListener <IReplyChannel> listener = encoding.BuildChannelListener <IReplyChannel>(MockBindingContext.Create()); Assert.IsNotNull(listener, "HttpMessageEncodingBindingElement.BuildChannelListener should have returned an instance."); Assert.IsInstanceOfType(listener, typeof(HttpMessageEncodingChannelListener), "HttpMessageEncodingBindingElement.BuildChannelListener should have returned an HttpMessageEncodingChannelListener."); }
public void Clone_Returns_New_HttpMessageEncodingBindingElement_Instance() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); HttpMessageEncodingBindingElement encodingCloned = encoding.Clone() as HttpMessageEncodingBindingElement; Assert.IsNotNull(encodingCloned, "Clone should have returned a new instance of HttpMessageEncodingBindingElement"); Assert.AreNotSame(encoding, encodingCloned, "Clone should have returned a new instance of HttpMessageEncodingBindingElement"); }
public void CreateBindingElements_Contains_HttpTransportBindingElement_And_HttpMessageEncodingBindingElement_With_CredentialOnly_Security_Mode() { HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.TransportCredentialOnly); HttpTransportBindingElement transport = binding.CreateBindingElements().Find <HttpTransportBindingElement>(); Assert.IsNotNull(transport, "The HttpMessageBinding.CreateBindingElements should have returned a collection with HttpTransportBindingElement."); HttpMessageEncodingBindingElement encoder = binding.CreateBindingElements().Find <HttpMessageEncodingBindingElement>(); Assert.IsNotNull(encoder, "The HttpMessageBinding.CreateBindingElements should have returned a collection with HttpMessageEncodingBindingElement."); }
public void BuildChannelFactory_Throws() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelFactoryNotSupportedByHttpMessageEncodingBindingElement(typeof(HttpMessageEncodingBindingElement).Name), () => { encoding.BuildChannelFactory<IReplyChannel>(MockBindingContext.Create()); }); }
public void CreateBindingElements_Contains_HttpTransportBindingElement_And_HttpMessageEncodingBindingElement_By_Default() { HttpMessageBinding binding = new HttpMessageBinding(); HttpTransportBindingElement transport = binding.CreateBindingElements().Find <HttpTransportBindingElement>(); Assert.IsNotNull(transport, "The HttpMessageBinding.CreateBindingElements should have returned a collection with HttpTransportBindingElement."); HttpMessageEncodingBindingElement encoder = binding.CreateBindingElements().Find <HttpMessageEncodingBindingElement>(); Assert.IsNotNull(encoder, "The HttpMessageBinding.CreateBindingElements should have returned a collection with HttpMessageEncodingBindingElement."); }
private void Initialize() { this.security = new HttpMessageBindingSecurity(); this.httpTransportBindingElement = new HttpTransportBindingElement(); this.httpTransportBindingElement.ManualAddressing = true; this.httpsTransportBindingElement = new HttpsTransportBindingElement(); this.httpsTransportBindingElement.ManualAddressing = true; this.httpMessageEncodingBindingElement = new HttpMessageEncodingBindingElement(); }
public void Setting_MessageVersion_To_Null_Throws() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.ThrowsArgumentNull( "Setting HttpMessageEncodingBindingElement.MessageVersion to null should have thrown.", "value", () => { encoding.MessageVersion = null; }); }
public void BuildChannelFactory_Throws() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelFactory should have thrown.", () => { encoding.BuildChannelFactory<IReplyChannel>(MockBindingContext.Create()); }); }
public void BuildChannelFactory_Throws() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelFactory should have thrown.", () => { encoding.BuildChannelFactory <IReplyChannel>(MockBindingContext.Create()); }); }
public void Setting_MessageVersion_To_Other_Than_None_Throws() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws( typeof(NotSupportedException), "Setting HttpMessageEncodingBindingElement.MessageVersion to something other than MessageVersion.None should have thrown.", () => { encoding.MessageVersion = MessageVersion.Soap11; }); }
public void CanBuildChannelFactory_Always_Returns_False() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); Assert.IsFalse(encoding.CanBuildChannelFactory <IReplyChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IReplySessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IRequestChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IRequestSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IOutputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IOutputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IInputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IInputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IDuplexChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory <IDuplexSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); }
public void CanBuildChannelListener_Only_Returns_True_For_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); Assert.IsTrue(encoding.CanBuildChannelListener <IReplyChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should have returned 'true'."); Assert.IsFalse(encoding.CanBuildChannelListener <IReplySessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IRequestChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IRequestSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IOutputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IOutputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IInputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IInputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IDuplexChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener <IDuplexSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); }
public void Setting_MessageVersion_To_Other_Than_None_Throws() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws<NotSupportedException>( SR.OnlyMessageVersionNoneSupportedOnHttpMessageEncodingBindingElement(typeof(HttpMessageEncodingBindingElement)), () => { encoding.MessageVersion = MessageVersion.Soap11; }); }
public void MessageVersion_Is_Always_None() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); Assert.AreEqual(MessageVersion.None, encoding.MessageVersion, "HttpMessageEncodingBindingElement.MessageVersion should have been MessageVersion.None."); }
public void BuildChannelListener_Throws_For_Non_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IReplySessionChannel.", () => { encoding.BuildChannelListener <IReplySessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IRequestChannel.", () => { encoding.BuildChannelListener <IRequestChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IRequestSessionChannel.", () => { encoding.BuildChannelListener <IRequestSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IOutputChannel.", () => { encoding.BuildChannelListener <IOutputChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IOutputSessionChannel.", () => { encoding.BuildChannelListener <IOutputSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IInputChannel.", () => { encoding.BuildChannelListener <IInputChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IInputSessionChannel.", () => { encoding.BuildChannelListener <IInputSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IDuplexChannel.", () => { encoding.BuildChannelListener <IDuplexChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IDuplexSessionChannel.", () => { encoding.BuildChannelListener <IDuplexSessionChannel>(MockBindingContext.Create()); }); }
public void BuildChannelListener_Throws_For_Non_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IReplySessionChannel.", () => { encoding.BuildChannelListener<IReplySessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IRequestChannel.", () => { encoding.BuildChannelListener<IRequestChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IRequestSessionChannel.", () => { encoding.BuildChannelListener<IRequestSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IOutputChannel.", () => { encoding.BuildChannelListener<IOutputChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IOutputSessionChannel.", () => { encoding.BuildChannelListener<IOutputSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IInputChannel.", () => { encoding.BuildChannelListener<IInputChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IInputSessionChannel.", () => { encoding.BuildChannelListener<IInputSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IDuplexChannel.", () => { encoding.BuildChannelListener<IDuplexChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws( typeof(NotSupportedException), "HttpMessageEncodingBindingElement.BuildChannelListener should have thrown for IDuplexSessionChannel.", () => { encoding.BuildChannelListener<IDuplexSessionChannel>(MockBindingContext.Create()); }); }
public void CanBuildChannelListener_Only_Returns_True_For_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); Assert.IsTrue(encoding.CanBuildChannelListener<IReplyChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should have returned 'true'."); Assert.IsFalse(encoding.CanBuildChannelListener<IReplySessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IRequestChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IRequestSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IOutputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IOutputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IInputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IInputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IDuplexChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); Assert.IsFalse(encoding.CanBuildChannelListener<IDuplexSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelListener should always return 'false' for non IReplyChannel shapes."); }
public void CanBuildChannelFactory_Always_Returns_False() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); Assert.IsFalse(encoding.CanBuildChannelFactory<IReplyChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IReplySessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IRequestChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IRequestSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IOutputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IOutputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IInputChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IInputSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IDuplexChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); Assert.IsFalse(encoding.CanBuildChannelFactory<IDuplexSessionChannel>(MockBindingContext.Create()), "HttpMessageEncodingBindingElement.CanBuildChannelFactory should always return 'false'."); }
public void BuildChannelListener_Throws_For_Non_IReplyChannel() { HttpMessageEncodingBindingElement encoding = new HttpMessageEncodingBindingElement(); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IReplySessionChannel).Name), () => { encoding.BuildChannelListener<IReplySessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IRequestChannel).Name), () => { encoding.BuildChannelListener<IRequestChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IRequestSessionChannel).Name), () => { encoding.BuildChannelListener<IRequestSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IOutputChannel).Name), () => { encoding.BuildChannelListener<IOutputChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IOutputSessionChannel).Name), () => { encoding.BuildChannelListener<IOutputSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IInputChannel).Name), () => { encoding.BuildChannelListener<IInputChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IInputSessionChannel).Name), () => { encoding.BuildChannelListener<IInputSessionChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IDuplexChannel).Name), () => { encoding.BuildChannelListener<IDuplexChannel>(MockBindingContext.Create()); }); ExceptionAssert.Throws<NotSupportedException>( SR.ChannelShapeNotSupportedByHttpMessageEncodingBindingElement(typeof(IDuplexSessionChannel).Name), () => { encoding.BuildChannelListener<IDuplexSessionChannel>(MockBindingContext.Create()); }); }
private void Initialize() { this.security = new HttpBindingSecurity(); this.httpTransportBindingElement = new HttpTransportBindingElement(); this.httpTransportBindingElement.ManualAddressing = true; this.httpsTransportBindingElement = new HttpsTransportBindingElement(); this.httpsTransportBindingElement.ManualAddressing = true; this.httpHandlerBindingElement = new HttpMessageHandlerBindingElement(); this.httpMessageEncodingBindingElement = new HttpMessageEncodingBindingElement(); }
private static void ValidateEndpoint(ServiceEndpoint endpoint) { Fx.Assert(endpoint != null, "The 'endpoint' parameter should not be null."); // Ensure no message headers if (endpoint.Address != null && endpoint.Address.Headers.Count > 0) { throw Fx.Exception.AsError( new InvalidOperationException( SR.HttpServiceEndpointCannotHaveMessageHeaders( endpoint.Address))); } // Ensure http(s) scheme Binding binding = endpoint.Binding; if (binding == null) { throw Fx.Exception.AsError( new InvalidOperationException(SR.HttpBehaviorBindingRequired(httpBehaviorType.Name))); } if (binding.Scheme != Uri.UriSchemeHttp && binding.Scheme != Uri.UriSchemeHttps) { throw Fx.Exception.AsError( new InvalidOperationException( SR.InvalidUriScheme( endpoint.Address.Uri.AbsoluteUri))); } // Ensure MessageVersion.None if (binding.MessageVersion != MessageVersion.None) { throw Fx.Exception.AsError( new InvalidOperationException( SR.InvalidMessageVersion( endpoint.Address.Uri.AbsoluteUri))); } // Ensure manual addressing TransportBindingElement transportBindingElement = binding.CreateBindingElements().Find <TransportBindingElement>(); Fx.Assert(transportBindingElement != null, "The MessageVersion check would have failed if there is not a transportBindingElement."); if (!transportBindingElement.ManualAddressing) { throw Fx.Exception.AsError( new InvalidOperationException( SR.InvalidManualAddressingValue( endpoint.Address.Uri.AbsoluteUri))); } // Ensure HttpMessageEncodingBindingElement HttpMessageEncodingBindingElement httpMessageEncodingBindingElement = binding.CreateBindingElements().Find <HttpMessageEncodingBindingElement>(); if (httpMessageEncodingBindingElement == null) { throw Fx.Exception.AsError( new InvalidOperationException( SR.InvalidMessageEncodingBindingElement( endpoint.Address.Uri.AbsoluteUri, messageEncodingBindingElementType.Name, httpMessageEncodingBindingElementType.Name))); } }
private void Initialize() { _security = new HttpBindingSecurity(); _httpTransportBindingElement = new HttpTransportBindingElement(); _httpTransportBindingElement.ManualAddressing = true; _httpsTransportBindingElement = new HttpsTransportBindingElement(); _httpsTransportBindingElement.ManualAddressing = true; _httpMessageEncodingBindingElement = new HttpMessageEncodingBindingElement(); }