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); } } }
public void TestErrorWithNoParams() { var handler = new VRFYHandler(); handler.Initialize(Core); var response = handler.Execute(Transaction, ""); Assert.Equal(SMTPStatusCode.SyntaxError, response.Code); }
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); }