本文整理汇总了C#中RegressionTests.Shared.IMAPClientSimulator.Logon方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPClientSimulator.Logon方法的具体用法?C# IMAPClientSimulator.Logon怎么用?C# IMAPClientSimulator.Logon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.IMAPClientSimulator
的用法示例。
在下文中一共展示了IMAPClientSimulator.Logon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestBatchOfCommands
public void TestBatchOfCommands()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
string commandSequence = "";
for (int i = 0; i < 200; i++)
{
commandSequence += "A" + i.ToString() + " SELECT INBOX\r\n";
}
commandSequence = commandSequence.TrimEnd("\r\n".ToCharArray());
string result = oSimulator.Send(commandSequence);
CustomAssert.IsFalse(result.StartsWith("* BYE"));
oSimulator.Disconnect();
sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
commandSequence = "";
for (int i = 0; i < 500; i++)
{
commandSequence += "A" + i.ToString() + " SELECT INBOX\r\n";
}
commandSequence = commandSequence.TrimEnd("\r\n".ToCharArray());
result = oSimulator.Send(commandSequence);
CustomAssert.IsFalse(result.StartsWith("* BYE Excessive number of buffered commands"));
oSimulator.Disconnect();
}
示例2: TestNestedOrSearch
public void TestNestedOrSearch()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
var oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "Search test", "This is a test of IMAP Search");
IMAPClientSimulator.AssertMessageCount(oAccount.Address, "test", "Inbox", 1);
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
oSimulator.SelectFolder("INBOX");
string result =
oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008");
CustomAssert.IsTrue(result.StartsWith("* SEARCH 1"), result);
result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR SMALLER 1 LARGER 10000");
CustomAssert.IsTrue(result.StartsWith("* SEARCH\r\n"), result);
result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SMALLER 1 LARGER 10000 SMALLER 10000");
CustomAssert.IsTrue(result.StartsWith("* SEARCH 1\r\n"), result);
}
示例3: IfStlsRequiredLogonShouldFailIfNoStls
public void IfStlsRequiredLogonShouldFailIfNoStls()
{
var imapSimulator = new IMAPClientSimulator(false, 14303);
imapSimulator.Connect();
string errorMessage;
CustomAssert.IsFalse(imapSimulator.Logon(_account.Address, "test", out errorMessage));
CustomAssert.IsTrue(errorMessage.Contains("A01 BAD STARTTLS is required."));
}
示例4: IfStlsRequiredLogonShouldSucceedIfStls
public void IfStlsRequiredLogonShouldSucceedIfStls()
{
var imapSimulator = new IMAPClientSimulator(false, 14303);
imapSimulator.Connect();
imapSimulator.SendSingleCommand("A01 STARTTLS");
imapSimulator.Handshake();
// command is sent over TLS.
imapSimulator.GetCapabilities();
CustomAssert.IsTrue(imapSimulator.Logon(_account.Address, "test"));
}
示例5: TestCreateFolderWithHash
public void TestCreateFolderWithHash()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var oSimulator = new IMAPClientSimulator();
oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
CustomAssert.IsFalse(oSimulator.CreateFolder("#Test"));
CustomAssert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
oSimulator.Disconnect();
}
示例6: IfStlsOptionalButSslRequiredByIpRangeForAuthThenAuthShouldFail
public void IfStlsOptionalButSslRequiredByIpRangeForAuthThenAuthShouldFail()
{
var range = SingletonProvider<TestSetup>.Instance.GetApp().Settings.SecurityRanges.get_ItemByName("My computer");
range.RequireSSLTLSForAuth = true;
range.Save();
var imapSimulator = new IMAPClientSimulator(false, 14302);
imapSimulator.Connect();
string errorMessage;
CustomAssert.IsFalse(imapSimulator.Logon(_account.Address, "test", out errorMessage));
CustomAssert.IsTrue(errorMessage.Contains("A01 BAD A SSL/TLS-connection is required for authentication."));
}
示例7: TestCreateFolderWithSlash
public void TestCreateFolderWithSlash()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
const string folderName = "ABC\\123";
var oSimulator = new IMAPClientSimulator();
oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
CustomAssert.IsTrue(oSimulator.List().Contains(folderName));
CustomAssert.IsTrue(oSimulator.SelectFolder(folderName));
oSimulator.Disconnect();
}
示例8: TestAppendDeletedMessage
public void TestAppendDeletedMessage()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX (\\Deleted) {4}", "ABCD");
CustomAssert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
CustomAssert.AreEqual("1", oSimulator.Search("DELETED"));
oSimulator.Disconnect();
}
示例9: TestLongCommand
public void TestLongCommand()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
var sb = new StringBuilder();
for (int i = 0; i < 240000; i++)
{
sb.Append("A");
}
string result = oSimulator.Send("A01 " + sb);
CustomAssert.IsTrue(result.Length == 0 || result.StartsWith("A01"));
}
示例10: TestHierarchyDelimiterListResponse
public void TestHierarchyDelimiterListResponse()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
Settings settings = _settings;
settings.IMAPHierarchyDelimiter = "\\";
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
string folderName = "Test\\Test";
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
string listResponse = oSimulator.List();
CustomAssert.IsTrue(listResponse.Contains("\"Test\\Test\""));
CustomAssert.IsTrue(listResponse.Contains("\"Test\""));
oSimulator.Disconnect();
}
示例11: TestAppendFolderNameInOctet
public void TestAppendFolderNameInOctet()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
oSimulator.SelectFolder("INBOX");
oSimulator.CreateFolder("MONK");
oSimulator.SendRaw("A01 APPEND {4}\r\n");
string result = oSimulator.Receive();
CustomAssert.IsTrue(result.StartsWith("+ Ready for additional command text."));
oSimulator.SendRaw("MONK (\\Seen) \"20-Jan-2009 12:59:50 +0100\" {5}\r\n");
result = oSimulator.Receive();
CustomAssert.IsTrue(result.StartsWith("+ Ready for literal data"));
oSimulator.SendRaw("WOOOT\r\n");
result = oSimulator.Receive();
CustomAssert.AreEqual("A01 OK APPEND completed\r\n", result);
}
示例12: TestFolderLSUBUnsubscribedFolder
public void TestFolderLSUBUnsubscribedFolder()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
const string folderName = "ABC.def.GHI";
var oSimulator = new IMAPClientSimulator();
oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
CustomAssert.IsFalse(oSimulator.LSUB().Contains("\r\n\r\n"));
oSimulator.Disconnect();
}
示例13: TestFolderCaseInLSUB
public void TestFolderCaseInLSUB()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
string folderName = "ABC.def.GHI";
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
CustomAssert.IsTrue(oSimulator.Subscribe(folderName));
CustomAssert.IsFalse(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.def.GHI"));
CustomAssert.IsTrue(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.DEF.GHI"));
CustomAssert.IsFalse(oSimulator.LSUB("ABC.def.*").Contains("ABC.DEF"));
CustomAssert.IsTrue(oSimulator.LSUB("ABC.def.*").Contains("ABC.def.GHI"));
CustomAssert.IsTrue(oSimulator.SelectFolder(folderName));
oSimulator.Disconnect();
}
示例14: TestSearch
public void TestSearch()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "se'[email protected]", "test");
// Send a message to this account.
var oSMTP = new SMTPClientSimulator();
oSMTP.Send(oAccount.Address, oAccount.Address, "Search test", "This is a test of IMAP Search");
IMAPClientSimulator.AssertMessageCount(oAccount.Address, "test", "INBOX", 1);
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));
oSimulator.SetFlagOnFirstMessage(true, "\\ANSWERED");
if (oSimulator.Search("ANSWERED") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\ANSWERED");
if (oSimulator.Search("ANSWERED") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\DELETED");
if (oSimulator.Search("DELETED") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\DELETED");
if (oSimulator.Search("DELETED") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\DRAFT");
if (oSimulator.Search("DRAFT") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\DRAFT");
if (oSimulator.Search("DRAFT") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\FLAGGED");
if (oSimulator.Search("FLAGGED ") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\FLAGGED");
if (oSimulator.Search("FLAGGED") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\SEEN");
if (oSimulator.Search("SEEN") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\SEEN");
if (oSimulator.Search("SEEN") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\ANSWERED");
if (oSimulator.Search("UNANSWERED") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\ANSWERED");
if (oSimulator.Search("UNANSWERED") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\DELETED");
if (oSimulator.Search("UNDELETED") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\DELETED");
if (oSimulator.Search("UNDELETED") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\DRAFT");
if (oSimulator.Search("UNDRAFT") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\DRAFT");
if (oSimulator.Search("UNDRAFT") != "1")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(true, "\\FLAGGED");
if (oSimulator.Search("UNFLAGGED") != "")
throw new Exception("ERROR - Search or flag failed");
oSimulator.SetFlagOnFirstMessage(false, "\\FLAGGED");
if (oSimulator.Search("UNFLAGGED") != "1")
throw new Exception("ERROR - Search or flag failed");
// SEARCH using LARGER & SMALLER
if (oSimulator.Search("SMALLER 10") != "")
throw new Exception("ERROR - Search or flag failed");
if (oSimulator.Search("SMALLER 10000") != "1")
throw new Exception("ERROR - Search or flag failed");
if (oSimulator.Search("LARGER 10") != "1")
throw new Exception("ERROR - Search or flag failed");
//.........这里部分代码省略.........
示例15: TestSearchWithLiterals
public void TestSearchWithLiterals()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
var oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");
IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 1);
oSMTP.Send("[email protected]", "[email protected]", "Test2", "This is a test of IMAP Search");
IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);
var oSimulator = new IMAPClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));
string result = oSimulator.SendSingleCommandWithLiteral("A01 SEARCH HEADER SUBJECT {5}", "Test1");
CustomAssert.IsTrue(result.StartsWith("* SEARCH 1\r\n"));
result = oSimulator.SendSingleCommandWithLiteral("A01 SEARCH HEADER SUBJECT {5}", "Test2");
CustomAssert.IsTrue(result.StartsWith("* SEARCH 2\r\n"));
}