Beispiel #1
0
        public void TestSuccess(string search, string[] emails, bool[] found)
        {
            var mailboxes = emails.Select(e => (Mailbox) new ShimMailbox
            {
                ToString = () => e
            }).ToList();

            AddCoreListProperty("Mailboxes", () => mailboxes);

            var handler = new VRFYHandler();

            handler.Initialize(Core);

            var response   = handler.Execute(Transaction, search);
            var foundCount = found.Count(f => f);

            Assert.Equal(foundCount > 1 ? SMTPStatusCode.MailboxNameNotAllowed : SMTPStatusCode.Okay, response.Code);
            Assert.Equal(response.Args.Length, foundCount);

            for (var i = 0; i < emails.Length; i++)
            {
                if (found[i])
                {
                    Assert.Contains(emails[i], response.Args);
                }
                else
                {
                    Assert.DoesNotContain(emails[i], response.Args);
                }
            }
        }
Beispiel #2
0
        public void TestErrorWithNoParams()
        {
            var handler = new VRFYHandler();

            handler.Initialize(Core);

            var response = handler.Execute(Transaction, "");

            Assert.Equal(SMTPStatusCode.SyntaxError, response.Code);
        }
Beispiel #3
0
        public void TestNotFound()
        {
            var handler = new VRFYHandler();

            handler.Initialize(Core);

            AddCoreListProperty("Mailboxes", new List <Mailbox>());

            var response = handler.Execute(Transaction, "*****@*****.**");

            Assert.Equal(SMTPStatusCode.MailboxUnavailiableError, response.Code);
        }