本文整理汇总了C#中IMAPSimulator.Logon方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPSimulator.Logon方法的具体用法?C# IMAPSimulator.Logon怎么用?C# IMAPSimulator.Logon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMAPSimulator
的用法示例。
在下文中一共展示了IMAPSimulator.Logon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestNestedOrSearch
public void TestNestedOrSearch()
{
hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
;
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
SMTPClientSimulator oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "Search test", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount(oAccount.Address, "test", "Inbox", 1);
IMAPSimulator oSimulator = new IMAPSimulator();
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");
Assert.IsTrue(result.StartsWith("* SEARCH 1"), result);
result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR SMALLER 1 LARGER 10000");
Assert.IsTrue(result.StartsWith("* SEARCH\r\n"), result);
result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SMALLER 1 LARGER 10000 SMALLER 10000");
Assert.IsTrue(result.StartsWith("* SEARCH 1\r\n"), result);
}
示例2: TestCreateFolderWithHash
public void TestCreateFolderWithHash()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
Assert.IsFalse(oSimulator.CreateFolder("#Test"));
Assert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
oSimulator.Disconnect();
}
示例3: TestCreateFolderWithSlash
public void TestCreateFolderWithSlash()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
string folderName = "ABC\\123";
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
Assert.IsTrue(oSimulator.CreateFolder(folderName));
Assert.IsTrue(oSimulator.List().Contains(folderName));
Assert.IsTrue(oSimulator.SelectFolder(folderName));
oSimulator.Disconnect();
}
示例4: TestAppendDeletedMessage
public void TestAppendDeletedMessage()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX (\\Deleted) {4}", "ABCD");
Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
Assert.AreEqual("1", oSimulator.Search("DELETED"));
oSimulator.Disconnect();
}
示例5: TestHierarchyDelimiterListResponse
public void TestHierarchyDelimiterListResponse()
{
hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
hMailServer.Settings settings = _settings;
settings.IMAPHierarchyDelimiter = "\\";
hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
string folderName = "Test\\Test";
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
Assert.IsTrue(oSimulator.CreateFolder(folderName));
string listResponse = oSimulator.List();
Assert.IsTrue(listResponse.Contains("\"Test\\Test\""));
Assert.IsTrue(listResponse.Contains("\"Test\""));
oSimulator.Disconnect();
}
示例6: TestAppendFolderNameInOctet
public void TestAppendFolderNameInOctet()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPSimulator oSimulator = new IMAPSimulator();
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();
Assert.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();
Assert.IsTrue(result.StartsWith("+ Ready for literal data"));
oSimulator.SendRaw("WOOOT\r\n");
result = oSimulator.Receive();
Assert.AreEqual("A01 OK APPEND completed\r\n", result);
}
示例7: TestSearchRange
public void TestSearchRange()
{
hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
;
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
SMTPClientSimulator oSMTP = new SMTPClientSimulator();
for (int i = 0; i <5 ; i++)
oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 5);
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
Assert.IsTrue(oSimulator.SelectFolder("INBOX"));
string result = oSimulator.SendSingleCommand("a01 search 2:4");
Assert.IsTrue(result.StartsWith("* SEARCH 2 3 4"));
result = oSimulator.SendSingleCommand("a01 search 3,2");
Assert.IsTrue(result.StartsWith("* SEARCH 2 3"));
result = oSimulator.SendSingleCommand("a01 search 3:*");
Assert.IsTrue(result.StartsWith("* SEARCH 3 4 5"));
result = oSimulator.SendSingleCommand("a01 search 3,1,3");
Assert.IsTrue(result.StartsWith("* SEARCH 1 3"));
result = oSimulator.SendSingleCommand("a01 search 1:*");
Assert.IsTrue(result.StartsWith("* SEARCH 1 2 3 4 5"));
}
示例8: TestSearchORWithParenthesisSubjectNested
public void TestSearchORWithParenthesisSubjectNested()
{
hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
;
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
SMTPClientSimulator oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 1);
oSMTP.Send("[email protected]", "[email protected]", "Test2", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
Assert.IsTrue(oSimulator.SelectFolder("INBOX"));
if (oSimulator.Search("ALL (OR (HEADER SUBJECT \"Test1\") (HEADER SUBJECT \"Test2\"))") != "1 2")
{
throw new Exception("ERROR - Search or flag failed");
}
}
示例9: TestAppendFolderNameInOctetNoFlagList
public void TestAppendFolderNameInOctetNoFlagList()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPSimulator oSimulator = new IMAPSimulator();
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();
Assert.IsTrue(result.StartsWith("+ Ready for additional command text."));
oSimulator.SendRaw("MONK \"12-Jan-2009 12:12:12 +0100\" {5}\r\n");
result = oSimulator.Receive();
Assert.IsTrue(result.StartsWith("+ Ready for literal data"));
oSimulator.SendRaw("WOOOT\r\n");
result = oSimulator.Receive();
Assert.AreEqual("A01 OK APPEND completed\r\n", result);
DateTime date = Convert.ToDateTime(oAccount.IMAPFolders.get_ItemByName("MONK").Messages[0].InternalDate);
Assert.AreEqual(2009, date.Year);
Assert.AreEqual(12, date.Day);
Assert.AreEqual(1, date.Month);
}
示例10: TestConnectionObjectRelease
public void TestConnectionObjectRelease()
{
Utilities.DeleteCurrentDefaultLog();
_settings.IMAPIdleEnabled = true;
hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPSimulator simulator = new IMAPSimulator();
string data;
string sWelcomeMessage = simulator.Connect();
simulator.Logon(account.Address, "test");
Assert.IsTrue(simulator.SelectFolder("INBOX"));
Assert.IsTrue(simulator.StartIdle());
Assert.IsTrue(simulator.EndIdle(true, out data));
Assert.IsTrue(simulator.Logout());
string logData = Utilities.ReadCurrentDefaultLog();
Assert.IsTrue(Utilities.DefaultLogContains("Ending session"));
}
示例11: TestLsubInclusion
public void TestLsubInclusion()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
string folderName = "Folder1";
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
Assert.IsTrue(oSimulator.CreateFolder(folderName));
Assert.IsFalse(oSimulator.LSUB().Contains(folderName));
Assert.IsTrue(oSimulator.Subscribe(folderName));
Assert.IsTrue(oSimulator.LSUB().Contains(folderName));
oSimulator.Disconnect();
}
示例12: TestFolderCaseInLSUB
public void TestFolderCaseInLSUB()
{
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
string folderName = "ABC.def.GHI";
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(oAccount.Address, "test");
Assert.IsTrue(oSimulator.CreateFolder(folderName));
Assert.IsTrue(oSimulator.Subscribe(folderName));
Assert.IsFalse(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.def.GHI"));
Assert.IsTrue(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.DEF.GHI"));
Assert.IsFalse(oSimulator.LSUB("ABC.def.*").Contains("ABC.DEF"));
Assert.IsTrue(oSimulator.LSUB("ABC.def.*").Contains("ABC.def.GHI"));
Assert.IsTrue(oSimulator.SelectFolder(folderName));
oSimulator.Disconnect();
}
示例13: TestSearchWithLiterals
public void TestSearchWithLiterals()
{
hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
;
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
SMTPClientSimulator oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 1);
oSMTP.Send("[email protected]", "[email protected]", "Test2", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
Assert.IsTrue(oSimulator.SelectFolder("INBOX"));
string result = oSimulator.SendSingleCommandWithLiteral("A01 SEARCH HEADER SUBJECT {5}", "Test1");
Assert.IsTrue(result.StartsWith("* SEARCH 1\r\n"));
result = oSimulator.SendSingleCommandWithLiteral("A01 SEARCH HEADER SUBJECT {5}", "Test2");
Assert.IsTrue(result.StartsWith("* SEARCH 2\r\n"));
}
示例14: TestSortReverseArrival
public void TestSortReverseArrival()
{
hMailServer.Domain oDomain = _application.Domains[0];
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
SMTPClientSimulator oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 1);
// The two messages needs to be sent a second apart, so we actually need to pause a bit here.
System.Threading.Thread.Sleep(1000);
oSMTP.Send("[email protected]", "[email protected]", "Test2", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
Assert.IsTrue(oSimulator.SelectFolder("INBOX"));
Assert.AreEqual("1 2", oSimulator.Sort("(ARRIVAL) UTF-8 ALL"));
Assert.AreEqual("2 1", oSimulator.Sort("(REVERSE ARRIVAL) UTF-8 ALL"));
}
示例15: TestSortDeletedOrAnswered
public void TestSortDeletedOrAnswered()
{
hMailServer.Domain oDomain = _application.Domains[0];
hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");
// Send a message to this account.
SMTPClientSimulator oSMTP = new SMTPClientSimulator();
oSMTP.Send("[email protected]", "[email protected]", "aa", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 1);
oSMTP.Send("[email protected]", "[email protected]", "bb", "This is a test of IMAP Search");
IMAPSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);
IMAPSimulator oSimulator = new IMAPSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
Assert.IsTrue(oSimulator.SelectFolder("INBOX"));
Assert.AreEqual("", oSimulator.Sort("(DATE) UTF-8 ALL OR ANSWERED DELETED"));
}