public void TestCloneUsingSaslMechanismsNull() { var original = new PopClientProfile(new Uri("pop://user@localhost/")); original.UsingSaslMechanisms = null; var cloned = original.Clone(); Assert.AreNotSame(cloned, original); Assert.AreNotSame(original.Authority, cloned.Authority); Assert.AreEqual(original.Authority, cloned.Authority); Assert.IsNull(cloned.UsingSaslMechanisms); }
public void TestClone() { var original = new PopClientProfile(new Uri("pop://user@localhost/")); original.Timeout = 1; original.ReceiveTimeout = 2; original.SendTimeout = 3; original.UseTlsIfAvailable = false; original.UsingSaslMechanisms = new string[] {"X-SASL-EXT"}; original.AllowInsecureLogin = true; var cloned = original.Clone(); Assert.AreNotSame(cloned, original); Assert.AreNotSame(original.Authority, cloned.Authority); Assert.AreEqual(original.Authority, cloned.Authority); Assert.AreEqual(1, cloned.Timeout); Assert.AreEqual(2, cloned.ReceiveTimeout); Assert.AreEqual(3, cloned.SendTimeout); Assert.IsFalse(cloned.UseTlsIfAvailable); Assert.AreNotSame(original.UsingSaslMechanisms, cloned.UsingSaslMechanisms); CollectionAssert.AreEqual(original.UsingSaslMechanisms, cloned.UsingSaslMechanisms); Assert.IsTrue(cloned.AllowInsecureLogin); }
public ConnectParams(PopClientProfile profile, SaslClientMechanism authMechanism, UpgradeConnectionStreamCallback createSslStreamCallback) { Profile = profile.Clone(); AuthMechanism = authMechanism; CreateSslStreamCallback = createSslStreamCallback; }
public ConnectParams(PopClientProfile profile, ICredentialsByHost credentials, UpgradeConnectionStreamCallback createSslStreamCallback) { Profile = profile.Clone(); Profile.SetCredentials(credentials); CreateSslStreamCallback = createSslStreamCallback; }
public PopClient(PopClientProfile profile) { if (profile == null) throw new ArgumentNullException("profile"); this.profile = profile; }
public void TestConstruct() { Assert.AreEqual(new Uri("pop://localhost/"), DefaultPropertyAssertion(new PopClient()).Profile.Authority, "#1 authority"); Assert.AreEqual(new Uri("pop://user;[email protected]:10110/"), DefaultPropertyAssertion(new PopClient(new Uri("pop://user;[email protected]:10110/"))).Profile.Authority, "#2 authority"); Assert.AreEqual(new Uri("pop://pop.example.net/"), DefaultPropertyAssertion(new PopClient("pop.example.net")).Profile.Authority, "#3 authority"); Assert.AreEqual(new Uri("pop://[email protected]/"), DefaultPropertyAssertion(new PopClient("pop.example.net", "user")).Profile.Authority, "#4 authority"); Assert.AreEqual(new Uri("pops://[email protected]/"), DefaultPropertyAssertion(new PopClient("pop.example.net", true, "user")).Profile.Authority, "#5 authority"); Assert.AreEqual(new Uri("pop://pop.example.net:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110)).Profile.Authority, "#6 authority"); Assert.AreEqual(new Uri("pop://[email protected]:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110, "user")).Profile.Authority, "#7 authority"); Assert.AreEqual(new Uri("pop://[email protected]:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110, "user")).Profile.Authority, "#8 authority"); Assert.AreEqual(new Uri("pops://[email protected]:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110, true, "user")).Profile.Authority, "#9 authority"); Assert.AreEqual(new Uri("pop://user;[email protected]:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110, "user", "+APOP")).Profile.Authority, "#10 authority"); Assert.AreEqual(new Uri("pops://user;[email protected]:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110, true, "user", "DIGEST-MD5")).Profile.Authority, "#11 authority"); Assert.AreEqual(new Uri("pops://[email protected]:10110/"), DefaultPropertyAssertion(new PopClient("pop.example.net", 10110, true, "user", null, 1000), 1000).Profile.Authority, "#12 authority"); var profile = new PopClientProfile(new Uri("pops://[email protected]/")); Assert.AreEqual(new Uri("pops://[email protected]/"), DefaultPropertyAssertion(new PopClient(profile)).Profile.Authority, "#13 authority"); }