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 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.");
        }
        public void CreateBindingElements_Count_Is_Always_Two()
        {
            HttpMessageBinding binding = new HttpMessageBinding();
            Assert.AreEqual(2, binding.CreateBindingElements().Count, "The HttpMessageBinding should always have two binding elements.");

            HttpMessageBinding bindingWithSecurity = new HttpMessageBinding(HttpMessageBindingSecurityMode.Transport);
            Assert.AreEqual(2, bindingWithSecurity.CreateBindingElements().Count, "The HttpMessageBinding should always have two binding elements.");

            HttpMessageBinding bindingWithSecurity2 = new HttpMessageBinding(HttpMessageBindingSecurityMode.TransportCredentialOnly);
            Assert.AreEqual(2, bindingWithSecurity2.CreateBindingElements().Count, "The HttpMessageBinding should always have two binding elements.");
        }
        public void Setting_Name_Empty_String_Throws()
        {
            HttpMessageBinding binding = new HttpMessageBinding();

            ExceptionAssert.Throws(
                typeof(ArgumentException),
                "Setting HttpMessageBinding.Name to empty string should have thrown.",
                () =>
                {
                    binding.Name = string.Empty;
                });
        }
        public void Setting_Namespace_To_Null_Throws()
        {
            HttpMessageBinding binding = new HttpMessageBinding();

            ExceptionAssert.ThrowsArgumentNull(
                "Setting HttpMessageBinding.Namespace to null should have thrown.",
                "value",
                () =>
                {
                    binding.Namespace = null;
                });
        }
        public void Name_Can_Be_Set()
        {
            HttpMessageBinding binding = new HttpMessageBinding();
            binding.Name = "SomeName";
            Assert.AreEqual("SomeName", binding.Name, "HttpMessageBinding.Name should have been 'SomeName'.");

            binding.Name = " ";
            Assert.AreEqual(" ", binding.Name, "HttpMessageBinding.Name should have been ' '.");
        }
        public void HostNameComparisonMode_Can_Be_Set()
        {
            HttpMessageBinding binding = new HttpMessageBinding();
            binding.HostNameComparisonMode = HostNameComparisonMode.Exact;
            Assert.AreEqual(HostNameComparisonMode.Exact, binding.HostNameComparisonMode, "HttpMessageBinding.HostNameComparisonMode should have been HostNameComparisonMode.Exact.");

            binding.HostNameComparisonMode = HostNameComparisonMode.WeakWildcard;
            Assert.AreEqual(HostNameComparisonMode.WeakWildcard, binding.HostNameComparisonMode, "HttpMessageBinding.HostNameComparisonMode should have been HostNameComparisonMode.WeakWildcard.");
        }
 public void OpenTimeout_Is_One_Minute_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual(new TimeSpan(0, 1, 0), binding.OpenTimeout, "HttpMessageBinding.OpenTimeout should have been 00:01:00 by default.");
 }
        public void TransferMode_Can_Be_Set()
        {
            HttpMessageBinding binding = new HttpMessageBinding();
            binding.TransferMode = TransferMode.Streamed;
            Assert.AreEqual(TransferMode.Streamed, binding.TransferMode, "HttpMessageBinding.TransferMode should have been TransferMode.Streamed.");

            binding.TransferMode = TransferMode.StreamedRequest;
            Assert.AreEqual(TransferMode.StreamedRequest, binding.TransferMode, "HttpMessageBinding.TransferMode should have been TransferMode.StreamedRequest.");

            binding.TransferMode = TransferMode.StreamedResponse;
            Assert.AreEqual(TransferMode.StreamedResponse, binding.TransferMode, "HttpMessageBinding.TransferMode should have been TransferMode.StreamedResponse.");
        }
 public void Security_Mode_Agrees_With_Constructor_Parameter_Value()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.Transport);
     Assert.AreEqual(HttpMessageBindingSecurityMode.Transport, binding.Security.Mode, "The HttpMessageBinding.Security.Mode should have been HttpMessageBindingSecurityMode.Transport.");
 }
 public void Setting_Security_Transport_ClientCredentialType_Certificate_Configures_The_HttpsTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.Transport);
     binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
     HttpsTransportBindingElement transport = binding.CreateBindingElements().Find<HttpsTransportBindingElement>();
     Assert.IsTrue(transport.RequireClientCertificate, "HttpsTransportBindingElement.RequireClientCertificate should have been 'true'.");
 }
 public void Scheme_Is_Http_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual("http", binding.Scheme, "HttpMessageBinding.Scheme should have been 'http' by default.");
 }
 public void Scheme_Is_Http_With_TransportCredentialOnly_Security()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.TransportCredentialOnly);
     Assert.AreEqual("http", binding.Scheme, "HttpMessageBinding.Scheme should have been 'http'.");
 }
 public void Scheme_Is_Https_With_Transport_Security()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.Transport);
     Assert.AreEqual("https", binding.Scheme, "HttpMessageBinding.Scheme should have been 'https'.");
 }
 public void ReceiveTimeout_Is_Ten_Minutes_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual(new TimeSpan(0, 10, 0), binding.ReceiveTimeout, "HttpMessageBinding.ReceiveTimeout should have been 00:10:00 by default.");
 }
 public void ReceiveSynchronously_Always_Returns_False()
 {
     IBindingRuntimePreferences binding = new HttpMessageBinding() as IBindingRuntimePreferences;
     Assert.IsFalse(binding.ReceiveSynchronously, "IBindingRuntimePreferences.ReceiveSynchronously should always be 'false'.");
 }
        public void Setting_Name_To_Null_Throws()
        {
            HttpMessageBinding binding = new HttpMessageBinding();

            ExceptionAssert.Throws(
                typeof(ArgumentException),
                "Setting HttpMessageBinding.Name to null should have thrown.",
                () =>
                {
                    binding.Name = null;
                });
        }
 public void Setting_Security_Transport_Realm_Configures_The_HttpTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.TransportCredentialOnly);
     binding.Security.Transport.Realm = "SomeRealm";
     HttpTransportBindingElement transport = binding.CreateBindingElements().Find<HttpTransportBindingElement>();
     Assert.AreEqual("SomeRealm", transport.Realm, "HttpTransportBindingElement.Realm should have been 'SomeRealm'.");
 }
 public void Security_Mode_Is_None_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual(HttpMessageBindingSecurityMode.None, binding.Security.Mode, "The HttpMessageBinding.Security.Mode should have been HttpMessageBindingSecurityMode.None by default.");
 }
 public void Name_Is_HttpMessageBinding_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual("HttpMessageBinding", binding.Name, "HttpMessageBinding.Name should have been 'HttpMessageBinding'.");
 }
 public void Setting_Security_Transport_ProxyCredentialType_Configures_The_HttpTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.TransportCredentialOnly);
     binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
     HttpTransportBindingElement transport = binding.CreateBindingElements().Find<HttpTransportBindingElement>();
     Assert.AreEqual(AuthenticationSchemes.Basic, transport.ProxyAuthenticationScheme, "HttpTransportBindingElement.ProxyAuthenticationScheme should have been AuthenticationSchemes.Basic.");
 }
        public void Security_Throws_If_Set_To_Null()
        {
            HttpMessageBinding binding = new HttpMessageBinding();
            Assert.IsNotNull(binding.Security, "HttpMessageBinding.Security should never by null.");

            ExceptionAssert.ThrowsArgumentNull(
                "HttpMessageBinding.Security should have thrown when set to null.",
                "value",
                () =>
                {
                    binding.Security = null;
                });
        }
 public void Setting_TransferMode_Configures_The_HttpTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     binding.TransferMode = TransferMode.StreamedRequest;
     HttpTransportBindingElement transport = binding.CreateBindingElements().Find<HttpTransportBindingElement>();
     Assert.AreEqual(TransferMode.StreamedRequest, transport.TransferMode, "HttpTransportBindingElement.TransferMode should have been TransferMode.StreamedRequest.");
 }
 public void Setting_HostNameComparisonMode_Configures_The_HttpTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     binding.HostNameComparisonMode = HostNameComparisonMode.Exact;
     HttpTransportBindingElement transport = binding.CreateBindingElements().Find<HttpTransportBindingElement>();
     Assert.AreEqual(HostNameComparisonMode.Exact, transport.HostNameComparisonMode, "HttpTransportBindingElement.HostNameComparisonMode should have been HostNameComparisonMode.Exact.");
 }
 public void TransferMode_Is_Buffered_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual(TransferMode.Buffered, binding.TransferMode, "HttpMessageBinding.TransferMode should have been TransferMode.Buffered by default.");
 }
 public void Setting_MaxBufferSize_Configures_The_HttpsTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding(HttpMessageBindingSecurityMode.Transport);
     binding.MaxBufferSize = 100;
     HttpsTransportBindingElement transport = binding.CreateBindingElements().Find<HttpsTransportBindingElement>();
     Assert.AreEqual(100, transport.MaxBufferSize, "HttpsTransportBindingElement.MaxBufferSize should have been 100.");
 }
 public void EnvelopeVersion_Is_Always_None()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual(EnvelopeVersion.None, binding.EnvelopeVersion, "HttpMessageBinding.EnvelopeVersion should always be EnvelopeVersion.None.");
 }
 public void Setting_MaxReceivedMessageSize_Configures_The_HttpTransportBindingElement()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     binding.MaxReceivedMessageSize = 100;
     HttpTransportBindingElement transport = binding.CreateBindingElements().Find<HttpTransportBindingElement>();
     Assert.AreEqual(100, transport.MaxReceivedMessageSize, "HttpTransportBindingElement.MaxReceivedMessageSize should have been 100.");
 }
 public void HostNameComparisonMode_Is_StrongWildcard_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual(HostNameComparisonMode.StrongWildcard, binding.HostNameComparisonMode, "HttpMessageBinding.HostNameComparisonMode should have been HostNameComparisonMode.StrongWildcard by default.");
 }
 public void Namespace_Is_TempuriOrg_By_Default()
 {
     HttpMessageBinding binding = new HttpMessageBinding();
     Assert.AreEqual("http://tempuri.org/", binding.Namespace, "HttpMessageBinding.Namespace should have been 'http://tempuri.org/' by default.");
 }