本文整理汇总了C#中RegressionTests.Shared.IMAPClientSimulator.GetWelcomeMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPClientSimulator.GetWelcomeMessage方法的具体用法?C# IMAPClientSimulator.GetWelcomeMessage怎么用?C# IMAPClientSimulator.GetWelcomeMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.IMAPClientSimulator
的用法示例。
在下文中一共展示了IMAPClientSimulator.GetWelcomeMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestIMAPLogonFailure
public void TestIMAPLogonFailure()
{
_settings.AutoBanOnLogonFailure = true;
_settings.MaxInvalidLogonAttempts = 4;
_settings.MaxInvalidLogonAttemptsWithin = 5;
_settings.AutoBanMinutes = 3;
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var sim = new IMAPClientSimulator();
CustomAssert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
sim.Disconnect();
// confirm that we can retrieve welcome message.
CustomAssert.IsTrue(sim.GetWelcomeMessage().StartsWith("* OK"));
// fail to log on 3 times.
for (int i = 0; i < 4; i++)
{
string errorMessage;
CustomAssert.IsFalse(sim.ConnectAndLogon(account.Address, "testA", out errorMessage));
sim.Disconnect();
if (i == 3)
{
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);
}