Beispiel #1
0
        public void Transport_Can_Be_Set()
        {
            HttpMessageBindingSecurity security  = new HttpMessageBindingSecurity();
            HttpTransportSecurity      transport = new HttpTransportSecurity();

            transport.ClientCredentialType = HttpClientCredentialType.Basic;
            security.Transport             = transport;
            Assert.AreEqual(HttpClientCredentialType.Basic, security.Transport.ClientCredentialType, "HttpMessageBindingSecurity.Transport.ClientCredentialType should have been HttpClientCredentialType.Basic.");
        }
Beispiel #2
0
        public void Transport_Resets_To_New_Instance_If_Set_To_Null()
        {
            HttpMessageBindingSecurity security  = new HttpMessageBindingSecurity();
            HttpTransportSecurity      transport = security.Transport;

            transport.ClientCredentialType = HttpClientCredentialType.Basic;
            security.Transport             = null;
            Assert.AreNotSame(transport, security.Transport, "HttpMessageBindingSecurity.Transport should have been a new instance of HttpTransportSecurity.");
            Assert.AreEqual(HttpClientCredentialType.None, security.Transport.ClientCredentialType, "HttpMessageBindingSecurity.Transport.ClientCredentialType should have been HttpClientCredentialType.None.");
        }
Beispiel #3
0
        public void Mode_Can_Be_Set()
        {
            HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();

            security.Mode = HttpMessageBindingSecurityMode.Transport;
            Assert.AreEqual(HttpMessageBindingSecurityMode.Transport, security.Mode, "HttpMessageBindingSecurity.Mode should have been HttpMessageBindingSecurityMode.Transport.");

            security.Mode = HttpMessageBindingSecurityMode.TransportCredentialOnly;
            Assert.AreEqual(HttpMessageBindingSecurityMode.TransportCredentialOnly, security.Mode, "HttpMessageBindingSecurity.Mode should have been HttpMessageBindingSecurityMode.TransportCredentialOnly.");
        }
Beispiel #4
0
 public void Mode_Throws_With_Invalid_HttpMessageBindingSecurityMode_Value()
 {
     ExceptionAssert.Throws(
         typeof(System.ComponentModel.InvalidEnumArgumentException),
         "HttpMessageBindingSecurity.Mode should have thrown since HttpMessageBindingSecurityMode is not a valid value.",
         () =>
     {
         HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();
         security.Mode = (HttpMessageBindingSecurityMode)99;
     });
 }
Beispiel #5
0
        internal void ApplyConfiguration(HttpMessageBindingSecurity security)
        {
            if (security == null)
            {
                throw new ArgumentNullException("security");
            }

            if (this.ElementInformation.Properties[ModeString].IsModified)
            {
                security.Mode = this.Mode;
                ApplyConfigurationToTransport(this.Transport, security.Transport);
            }
        }
Beispiel #6
0
        internal void InitializeFrom(HttpMessageBindingSecurity security)
        {
            if (security == null)
            {
                throw new ArgumentNullException("security");
            }

            if (security.Mode != HttpMessageBindingSecurity.DefaultMode)
            {
                this.Mode = security.Mode;
            }

            InitializeFromTransport(this.Transport, security.Transport);
        }
Beispiel #7
0
        public void Transport_Is_Not_Null()
        {
            HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();

            Assert.IsNotNull(security.Transport, "HttpMessageBindingSecurity.Transport should not be null.");
        }
Beispiel #8
0
        public void Mode_Is_None_By_Default()
        {
            HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();

            Assert.AreEqual(HttpMessageBindingSecurityMode.None, security.Mode, "HttpMessageBindingSecurity.Mode should have been HttpMessageBindingSecurityMode.None by default.");
        }
Beispiel #9
0
        public void Transport_Realm_Is_Empty_String_By_Default()
        {
            HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();

            Assert.AreEqual(string.Empty, security.Transport.Realm, "HttpMessageBindingSecurity.Transport.Realm should have been empty string.");
        }
Beispiel #10
0
        public void Transport_ExtendedProtectionPolicy_PolicyEnforcement_Is_Never_By_Default()
        {
            HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();

            Assert.AreEqual(PolicyEnforcement.Never, security.Transport.ExtendedProtectionPolicy.PolicyEnforcement, "HttpMessageBindingSecurity.Transport.ExtendedProtectionPolicy.PolicyEnforcement should have been PolicyEnforcement.Never by default.");
        }
Beispiel #11
0
        public void Transport_HttpProxyCredentialType_Is_None_By_Default()
        {
            HttpMessageBindingSecurity security = new HttpMessageBindingSecurity();

            Assert.AreEqual(HttpProxyCredentialType.None, security.Transport.ProxyCredentialType, "HttpMessageBindingSecurity.Transport.ProxyCredentialType should have been HttpProxyCredentialType.None by default.");
        }