public void TestCloneUsingSaslMechanismsNull()
        {
            var original = new ImapClientProfile(new Uri("imap://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 ImapClientProfile(new Uri("imap://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);
        }
Exemple #3
0
 public ConnectParams(ImapClientProfile profile,
                SaslClientMechanism authMechanism,
                UpgradeConnectionStreamCallback createSslStreamCallback)
 {
     Profile = profile.Clone();
     AuthMechanism = authMechanism;
     CreateSslStreamCallback = createSslStreamCallback;
 }
Exemple #4
0
            public ConnectParams(ImapClientProfile profile,
                           ICredentialsByHost credentials,
                           UpgradeConnectionStreamCallback createSslStreamCallback)
            {
                Profile = profile.Clone();
                Profile.SetCredentials(credentials);

                CreateSslStreamCallback = createSslStreamCallback;
            }
Exemple #5
0
        public ImapClient(ImapClientProfile profile)
        {
            if (profile == null)
            throw new ArgumentNullException("profile");

              this.profile = profile;
        }
Exemple #6
0
        public void TestConstruct()
        {
            Assert.AreEqual(new Uri("imap://localhost/"),
                      DefaultPropertyAssertion(new ImapClient()).Profile.Authority,
                      "#1 authority");

              Assert.AreEqual(new Uri("imap://user;[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient(new Uri("imap://user;[email protected]:10110/"))).Profile.Authority,
                      "#2 authority");

              Assert.AreEqual(new Uri("imap://imap.example.net/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net")).Profile.Authority,
                      "#3 authority");

              Assert.AreEqual(new Uri("imap://[email protected]/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", "user")).Profile.Authority,
                      "#4 authority");

              Assert.AreEqual(new Uri("imaps://[email protected]/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", true, "user")).Profile.Authority,
                      "#5 authority");

              Assert.AreEqual(new Uri("imap://imap.example.net:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110)).Profile.Authority,
                      "#6 authority");

              Assert.AreEqual(new Uri("imap://[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110, "user")).Profile.Authority,
                      "#7 authority");

              Assert.AreEqual(new Uri("imap://[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110, "user")).Profile.Authority,
                      "#8 authority");

              Assert.AreEqual(new Uri("imaps://[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110, true, "user")).Profile.Authority,
                      "#9 authority");

              Assert.AreEqual(new Uri("imap://user;[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110, "user", "PLAIN")).Profile.Authority,
                      "#10 authority");

              Assert.AreEqual(new Uri("imaps://user;[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110, true, "user", "DIGEST-MD5")).Profile.Authority,
                      "#11 authority");

              Assert.AreEqual(new Uri("imaps://[email protected]:10110/"),
                      DefaultPropertyAssertion(new ImapClient("imap.example.net", 10110, true, "user", null, 1000), 1000).Profile.Authority,
                      "#12 authority");

              var profile = new ImapClientProfile(new Uri("imaps://[email protected]/"));

              Assert.AreEqual(new Uri("imaps://[email protected]/"),
                      DefaultPropertyAssertion(new ImapClient(profile)).Profile.Authority,
                      "#13 authority");
        }