Exemplo n.º 1
0
        public void TestCreateSessionConnectFailure()
        {
            using (var server = new PopPseudoServer()) {
            server.Start();

            var credential = new NetworkCredential("user", "pass");
            var request = WebRequest.Create(string.Format("pop://{0}@{1}/", credential.UserName, server.HostPort)) as PopWebRequest;

            request.Timeout = 500;

            server.Stop();

            try {
              using (var response = request.GetResponse()) {
              }
            }
            catch (WebException ex) {
              WebExceptionAssertion(WebExceptionStatus.ConnectFailure, ex);
            }
              }
        }
Exemplo n.º 2
0
        public void TestCreateSessionCreateSslStreamCallbackNull()
        {
            using (var server = new PopPseudoServer()) {
            server.Start();

            var prof = new Profile(new NetworkCredential("user", "pass"), "POPS", "user", server.HostPort);

            prof.Timeout = 500;

            server.Stop();

            PopSessionCreator.CreateSession(prof, null, null);
              }
        }
Exemplo n.º 3
0
        public void TestCreateSessionConnectRefusedByTimeout()
        {
            using (var server = new PopPseudoServer()) {
            server.Start();

            var prof = new Profile(new NetworkCredential("user", "pass"), "user", server.HostPort);

            prof.Timeout = 500;

            server.Stop();

            try {
              PopSessionCreator.CreateSession(prof, null, null);

              Assert.Fail("PopConnectionException not thrown");
            }
            catch (PopConnectionException ex) {
              var timeoutException = ex.InnerException as TimeoutException;

              Assert.IsNotNull(timeoutException);
            }
              }
        }