本文整理汇总了C#中RegressionTests.Shared.SMTPClientSimulator.TestConnect方法的典型用法代码示例。如果您正苦于以下问题:C# SMTPClientSimulator.TestConnect方法的具体用法?C# SMTPClientSimulator.TestConnect怎么用?C# SMTPClientSimulator.TestConnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.SMTPClientSimulator
的用法示例。
在下文中一共展示了SMTPClientSimulator.TestConnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPortOpening
public void TestPortOpening()
{
Application oApp = SingletonProvider<TestSetup>.Instance.GetApp();
oApp.Settings.TCPIPPorts.SetDefault();
var pSMTPSimulator = new SMTPClientSimulator();
var pPOP3Simulator = new POP3Simulator();
var pIMAPSimulator = new IMAPSimulator();
oApp.Stop();
TCPIPPorts oPorts = oApp.Settings.TCPIPPorts;
for (int i = 0; i < oPorts.Count; i++)
{
TCPIPPort oTestPort = oPorts[i];
if (oTestPort.Protocol == eSessionType.eSTIMAP)
oTestPort.PortNumber = 14300;
else if (oTestPort.Protocol == eSessionType.eSTSMTP)
oTestPort.PortNumber = 11000;
else if (oTestPort.Protocol == eSessionType.eSTPOP3)
oTestPort.PortNumber = 2500;
oTestPort.Save();
}
oApp.Start();
CustomAssert.IsTrue(pSMTPSimulator.TestConnect(2500));
CustomAssert.IsTrue(pSMTPSimulator.TestConnect(11000));
CustomAssert.IsTrue(pSMTPSimulator.TestConnect(14300));
oApp.Stop();
TCPIPPort oPort = oApp.Settings.TCPIPPorts.Add();
oPort.Protocol = eSessionType.eSTSMTP;
oPort.PortNumber = 25000;
oPort.Save();
oApp.Start();
// Try to connect to the new port
CustomAssert.IsTrue(pSMTPSimulator.TestConnect(25000));
oApp.Stop();
// Delete the port again
oApp.Settings.TCPIPPorts.DeleteByDBID(oPort.ID);
// Change back the ports
for (int i = 0; i < oPorts.Count; i++)
{
TCPIPPort oTestPort = oPorts[i];
if (oTestPort.Protocol == eSessionType.eSTIMAP)
oTestPort.PortNumber = 143;
else if (oTestPort.Protocol == eSessionType.eSTSMTP)
oTestPort.PortNumber = 25;
else if (oTestPort.Protocol == eSessionType.eSTPOP3)
oTestPort.PortNumber = 110;
oTestPort.Save();
}
oApp.Start();
CustomAssert.IsTrue(pSMTPSimulator.TestConnect(25));
CustomAssert.IsTrue(pPOP3Simulator.TestConnect(110));
CustomAssert.IsTrue(pPOP3Simulator.TestConnect(143));
}