public void HttpTransportSecurityElement_InitializeFrom() { HttpTransportSecurityElement element = new HttpTransportSecurityElement() { ClientCredentialType = HttpClientCredentialType.Basic, ProxyCredentialType = HttpProxyCredentialType.Basic, Realm = "MyRealm" }; HttpTransportSecurity security = new HttpTransportSecurity(); // first initialize the transport security element.ApplyConfiguration(security); Assert.AreEqual(element.ClientCredentialType, security.ClientCredentialType, "ClientCredentialType failed"); Assert.AreEqual(element.ProxyCredentialType, security.ProxyCredentialType, "ProxyCredentialType failed"); Assert.AreEqual(element.Realm, security.Realm, "Realm failed"); Assert.IsNotNull(security.ExtendedProtectionPolicy, "ExtendedProtectionPolicy failed"); // now initialize a new instance from the security HttpTransportSecurityElement element2 = new HttpTransportSecurityElement(); element2.InitializeFrom(security); Assert.AreEqual(element.ClientCredentialType, element2.ClientCredentialType, "ClientCredentialType failed"); Assert.AreEqual(element.ProxyCredentialType, element2.ProxyCredentialType, "ProxyCredentialType failed"); Assert.AreEqual(element.Realm, element2.Realm, "Realm failed"); Assert.IsNotNull(element2.ExtendedProtectionPolicy, "ExtendedProtectionPolicy failed"); }
internal static void InitializeFromTransport(HttpTransportSecurityElement element, HttpTransportSecurity security) { if (security == null) { throw new ArgumentNullException("security"); } element.ClientCredentialType = security.ClientCredentialType; element.ProxyCredentialType = security.ProxyCredentialType; element.Realm = security.Realm; }
private static void ApplyConfigurationToTransport(HttpTransportSecurityElement element, HttpTransportSecurity security) { if (security == null) { throw new ArgumentNullException("security"); } security.ClientCredentialType = element.ClientCredentialType; security.ProxyCredentialType = element.ProxyCredentialType; security.Realm = element.Realm; }
public void HttpTransportSecurityElement_ApplyConfiguration() { HttpTransportSecurityElement element = new HttpTransportSecurityElement() { ClientCredentialType = HttpClientCredentialType.Basic, ProxyCredentialType = HttpProxyCredentialType.Basic, Realm = "MyRealm" }; HttpTransportSecurity security = new HttpTransportSecurity(); element.ApplyConfiguration(security); Assert.AreEqual(element.ClientCredentialType, security.ClientCredentialType, "ClientCredentialType failed"); Assert.AreEqual(element.ProxyCredentialType, security.ProxyCredentialType, "ProxyCredentialType failed"); Assert.AreEqual(element.Realm, security.Realm, "Realm failed"); Assert.IsNotNull(security.ExtendedProtectionPolicy, "ExtendedProtectionPolicy failed"); }