Esempio n. 1
0
        public void TestAutoReplyCombinedWithForwarding()
        {
            // Create a test account
            // Fetch the default domain
            Account oAccount1 = SingletonProvider <TestSetup> .Instance.AddAccount(_domain,
                                                                                   TestSetup.UniqueString() + "@test.com",
                                                                                   "test");

            Account oAccount2 = SingletonProvider <TestSetup> .Instance.AddAccount(_domain,
                                                                                   TestSetup.UniqueString() + "@test.com",
                                                                                   "test");

            Account oAccount3 = SingletonProvider <TestSetup> .Instance.AddAccount(_domain,
                                                                                   TestSetup.UniqueString() + "@test.com",
                                                                                   "test");

            oAccount2.VacationMessageIsOn = true;
            oAccount2.VacationMessage     = "I'm on vacation";
            oAccount2.VacationSubject     = "Out of office!";

            oAccount2.ForwardAddress      = oAccount3.Address;
            oAccount2.ForwardEnabled      = true;
            oAccount2.ForwardKeepOriginal = true;
            oAccount2.Save();

            // Send a message...
            var smtpClientSimulator = new SmtpClientSimulator();

            smtpClientSimulator.Send(oAccount1.Address, oAccount2.Address, "Test message", "This is the body");

            SingletonProvider <TestSetup> .Instance.GetApp().SubmitEMail();

            CustomAsserts.AssertRecipientsInDeliveryQueue(0);

            // Wait for the auto-reply.
            Pop3ClientSimulator.AssertMessageCount(oAccount1.Address, "test", 1);
            Pop3ClientSimulator.AssertMessageCount(oAccount2.Address, "test", 1);
            Pop3ClientSimulator.AssertMessageCount(oAccount3.Address, "test", 1);
        }
Esempio n. 2
0
        private void DownloadFromExternalAccount(Account account, FetchAccount fa)
        {
            if (!_backupMessages)
            {
                return;
            }

            // Download messages from the external account.
            var messages = new List <string>();

            messages.Add("Subject: Message 1\r\n");
            messages.Add("Subject: Message 2\r\n");
            messages.Add("Subject: Message 3\r\n");

            using (var pop3Server = new Pop3ServerSimulator(1, fa.Port, messages))
            {
                pop3Server.StartListen();
                fa.DownloadNow();
                pop3Server.WaitForCompletion();
            }

            CustomAsserts.AssertRecipientsInDeliveryQueue(0);
            Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 5);
        }
Esempio n. 3
0
 public static void DeleteEventLog()
 {
     CustomAsserts.AssertDeleteFile(GetEventLogFileName());
 }