本文整理汇总了C#中RegressionTests.Shared.SMTPClientSimulator.GetWelcomeMessage方法的典型用法代码示例。如果您正苦于以下问题:C# SMTPClientSimulator.GetWelcomeMessage方法的具体用法?C# SMTPClientSimulator.GetWelcomeMessage怎么用?C# SMTPClientSimulator.GetWelcomeMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.SMTPClientSimulator
的用法示例。
在下文中一共展示了SMTPClientSimulator.GetWelcomeMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestWelcomeMessage
public void TestWelcomeMessage()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
_settings.WelcomeSMTP = "HOWDYHO";
var oSimulator = new SMTPClientSimulator();
string sWelcomeMessage = oSimulator.GetWelcomeMessage();
if (sWelcomeMessage != "220 HOWDYHO\r\n")
throw new Exception("ERROR - Wrong welcome message.");
}
示例2: 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);
}