本文整理汇总了C#中RegressionTests.Shared.SMTPClientSimulator.ConnectAndLogon方法的典型用法代码示例。如果您正苦于以下问题:C# SMTPClientSimulator.ConnectAndLogon方法的具体用法?C# SMTPClientSimulator.ConnectAndLogon怎么用?C# SMTPClientSimulator.ConnectAndLogon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.SMTPClientSimulator
的用法示例。
在下文中一共展示了SMTPClientSimulator.ConnectAndLogon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEmptyPassword
public void TestEmptyPassword()
{
Account account1 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "");
string message;
var sim = new POP3Simulator();
Assert.IsFalse(sim.ConnectAndLogon(account1.Address, "", out message));
var simIMAP = new IMAPSimulator();
Assert.IsFalse(simIMAP.ConnectAndLogon(account1.Address, "", out message));
Assert.AreEqual("A01 NO Invalid user name or password.\r\n", message);
var simSMTP = new SMTPClientSimulator();
Assert.IsFalse(simSMTP.ConnectAndLogon(25, "dGVzdEB0ZXN0LmNvbQ==", "", out message));
Assert.AreEqual("535 Authentication failed. Restarting authentication process.\r\n", message);
}
示例2: TestSMTPServerAuthLogin
public void TestSMTPServerAuthLogin()
{
var sim = new SMTPClientSimulator();
string errorMsg;
sim.ConnectAndLogon(GetUsername(), GetPassword(), out errorMsg);
EnsureNoPassword();
}
示例3: TestSMTPLogonFailure
public void TestSMTPLogonFailure()
{
_settings.AutoBanOnLogonFailure = true;
_settings.MaxInvalidLogonAttempts = 2;
_settings.MaxInvalidLogonAttemptsWithin = 5;
_settings.AutoBanMinutes = 3;
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var sim = new SMTPClientSimulator();
//[email protected] / test
string errorMessage;
CustomAssert.IsTrue(sim.ConnectAndLogon("dGVzdEB0ZXN0LmNvbQ==", "dGVzdA==", out errorMessage));
sim.Disconnect();
// confirm that we can retrieve welcome message.
CustomAssert.IsTrue(sim.GetWelcomeMessage().StartsWith("220"));
// fail to log on 3 times.
for (int i = 0; i < 2; i++)
{
CustomAssert.IsFalse(sim.ConnectAndLogon("dGVzdEB0ZXN0LmNvbQ==", "Vaffe==", out errorMessage));
sim.Disconnect();
if (i == 2)
{
CustomAssert.IsTrue(errorMessage.Contains("Too many invalid logon attempts."));
}
}
CustomAssert.IsTrue(sim.GetWelcomeMessage().Length == 0);
string logText = TestSetup.ReadCurrentDefaultLog();
CustomAssert.IsTrue(logText.Contains("Blocked either by IP range or by connection limit."), logText);
}