public void TestBuildExample1() { var b = new PopUriBuilder(); b.Scheme = "pop"; b.Host = "mailsrv.qualcomm.com"; b.UserName = "******"; Assert.AreEqual(new Uri("pop://[email protected]"), b.Uri); }
public void TestBuildExample3() { var b = new PopUriBuilder(); b.Scheme = "pop"; b.Host = "foo.bar"; b.UserName = "******"; b.AuthType = new PopAuthenticationMechanism("SCRAM-MD5"); Assert.AreEqual(new Uri("pop://baz;[email protected]"), b.Uri); }
public void TestBuildExample2() { var b = new PopUriBuilder(); b.Scheme = "pop"; b.Host = "mail.eudora.com"; b.Port = 8110; b.UserName = "******"; b.AuthType = PopAuthenticationMechanism.Apop; Assert.AreEqual(new Uri("pop://rg;[email protected]:8110"), b.Uri); }
public void TestBuildUri() { var b = new PopUriBuilder(); b.Host = "pop.example.net"; Assert.AreEqual(new Uri("pop://pop.example.net/"), b.Uri); b.Port = 10110; Assert.AreEqual(new Uri("pop://pop.example.net:10110/"), b.Uri); b.UserName = "******"; Assert.AreEqual(new Uri("pop://[email protected]:10110/"), b.Uri); b.AuthType = PopAuthenticationMechanism.CRAMMD5; Assert.AreEqual(new Uri("pop://user;[email protected]:10110/"), b.Uri); b.Scheme = "pops"; Assert.AreEqual(new Uri("pops://user;[email protected]:10110/"), b.Uri); b.Scheme = "POP"; Assert.AreEqual(new Uri("pop://user;[email protected]:10110/"), b.Uri); b.UserName = null; Assert.AreEqual(new Uri("pop://;[email protected]:10110/"), b.Uri); b.Port = 110; Assert.AreEqual(new Uri("pop://;[email protected]:110/"), b.Uri); b.Port = 0; Assert.AreEqual(new Uri("pop://;[email protected]:0/"), b.Uri); b.Port = -1; Assert.AreEqual(new Uri("pop://;[email protected]/"), b.Uri); }
private void TransitStateTo(PopSessionState newState) { if (newState == state) return; switch (newState) { case PopSessionState.NotConnected: authority = null; if (state == PopSessionState.Update || state == PopSessionState.Transaction) TraceInfo("logged out"); TraceInfo("now in non-connected state"); break; case PopSessionState.Authorization: UpdateAuthority(null, null); TraceInfo("now in authorization state"); break; case PopSessionState.Transaction: TraceInfo("now in transaction state"); if (state == PopSessionState.Authorization) TraceInfo("logged in"); break; case PopSessionState.Update: TraceInfo("now in update state"); break; } state = newState; }
public void TestConstructFromUri() { var uri = "POPS://user;auth=cram-md5@localhost:10110"; var b = new PopUriBuilder(new Uri(uri)); Assert.AreEqual(new Uri("pops://user;AUTH=CRAM-MD5@localhost:10110"), b.Uri); Assert.AreEqual("pops", b.Scheme); Assert.AreEqual("user", b.UserName); Assert.AreEqual(PopAuthenticationMechanism.CRAMMD5, b.AuthType); Assert.AreEqual("localhost", b.Host); Assert.AreEqual(10110, b.Port); }
public void TestConstructDefault() { var b = new PopUriBuilder(); Assert.AreEqual(new Uri("pop://localhost/"), b.Uri); }
public void TestClone() { var origin = new PopUriBuilder("pops://user;auth=cram-md5@localhost:10110/"); var cloned = origin.Clone(); Assert.AreEqual(cloned, origin); Assert.AreEqual("pops", cloned.Scheme); Assert.AreEqual("user", cloned.UserName); Assert.AreEqual(PopAuthenticationMechanism.CRAMMD5, cloned.AuthType); Assert.AreEqual("localhost", cloned.Host); Assert.AreEqual(10110, cloned.Port); }
public PopClientProfile(Uri authority) { this.authority = new PopUriBuilder(authority); }