本文整理汇总了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);
Assert.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);
Assert.IsFalse(result.StartsWith("* BYE Excessive number of buffered commands"));
oSimulator.Disconnect();
}
示例2: RequestingSameHeaderFieldMultipleTimesShouldReturnItOnce
public void RequestingSameHeaderFieldMultipleTimesShouldReturnItOnce()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
string message = "From: Someone <[email protected]>" + Environment.NewLine +
"To: Someoen <[email protected]>" + Environment.NewLine +
"Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine +
"Subject: SubjectText" + Environment.NewLine +
Environment.NewLine +
"Hello" + Environment.NewLine;
var smtpSimulator = new SmtpClientSimulator();
smtpSimulator.SendRaw(account.Address, account.Address, message);
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 1);
var oSimulator = new ImapClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
oSimulator.SelectFolder("INBOX");
string result = oSimulator.Fetch("1 BODY.PEEK[HEADER.FIELDS (Subject Subject)]");
oSimulator.Disconnect();
Assert.AreEqual(1, StringExtensions.Occurences(result, "SubjectText"));
}
示例3: IfInReplyToFieldContainsQuoteThenFetchHeadersShouldEncodeIt
public void IfInReplyToFieldContainsQuoteThenFetchHeadersShouldEncodeIt()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
string message = "From: Someone <[email protected]>" + Environment.NewLine +
"To: Someoen <[email protected]>" + Environment.NewLine +
"In-Reply-To: ShouldBeEncodedDueToQuote\"" + Environment.NewLine +
"Subject: Something" + Environment.NewLine +
Environment.NewLine +
"Hello" + Environment.NewLine;
var smtpSimulator = new SmtpClientSimulator();
smtpSimulator.SendRaw(account.Address, account.Address, message);
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 1);
var oSimulator = new ImapClientSimulator();
string sWelcomeMessage = oSimulator.Connect();
oSimulator.Logon(account.Address, "test");
oSimulator.SelectFolder("INBOX");
string result = oSimulator.Fetch("1 ENVELOPE");
oSimulator.Disconnect();
Assert.IsFalse(result.Contains("ShouldBeEncodedDueToQuote"));
}
示例4: 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 smtpClientSimulator = new SmtpClientSimulator();
smtpClientSimulator.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");
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);
}
示例5: IfStlsRequiredLogonShouldFailIfNoStls
public void IfStlsRequiredLogonShouldFailIfNoStls()
{
var imapSimulator = new ImapClientSimulator(false, 14303);
imapSimulator.Connect();
string errorMessage;
Assert.IsFalse(imapSimulator.Logon(_account.Address, "test", out errorMessage));
Assert.IsTrue(errorMessage.Contains("A01 BAD STARTTLS is required."));
}
示例6: 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");
Assert.IsFalse(oSimulator.CreateFolder("#Test"));
Assert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
oSimulator.Disconnect();
}
示例7: 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();
Assert.IsTrue(imapSimulator.Logon(_account.Address, "test"));
}
示例8: 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;
Assert.IsFalse(imapSimulator.Logon(_account.Address, "test", out errorMessage));
Assert.IsTrue(errorMessage.Contains("A01 BAD A SSL/TLS-connection is required for authentication."));
}
示例9: 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");
Assert.IsTrue(oSimulator.CreateFolder(folderName));
Assert.IsTrue(oSimulator.List().Contains(folderName));
Assert.IsTrue(oSimulator.SelectFolder(folderName));
oSimulator.Disconnect();
}
示例10: 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");
Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
Assert.AreEqual("1", oSimulator.Search("DELETED"));
oSimulator.Disconnect();
}
示例11: 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);
Assert.IsTrue(result.Length == 0 || result.StartsWith("A01"));
}
示例12: 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");
Assert.IsTrue(oSimulator.CreateFolder(folderName));
string listResponse = oSimulator.List();
Assert.IsTrue(listResponse.Contains("\"Test\\Test\""));
Assert.IsTrue(listResponse.Contains("\"Test\""));
oSimulator.Disconnect();
}
示例13: 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();
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);
}
示例14: TestExpunge
public void TestExpunge()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
Account account1 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPFolders publicFolders = _settings.PublicFolders;
IMAPFolder folder = publicFolders.Add("Share1");
folder.Save();
IMAPFolderPermission permission = folder.Permissions.Add();
permission.PermissionAccountID = account1.ID;
permission.PermissionType = eACLPermissionType.ePermissionTypeUser;
permission.set_Permission(eACLPermission.ePermissionCreate, true);
permission.set_Permission(eACLPermission.ePermissionInsert, true);
permission.set_Permission(eACLPermission.ePermissionRead, true);
permission.set_Permission(eACLPermission.ePermissionWriteDeleted, true);
permission.Save();
string folderName = "#Public.Share1";
SmtpClientSimulator.StaticSend("[email protected]", account1.Address, "TestMessage", "Body");
CustomAsserts.AssertFolderMessageCount(account1.IMAPFolders.get_ItemByName("INBOX"), 1);
CustomAsserts.AssertFolderMessageCount(folder, 0);
var imapClientSimulator = new ImapClientSimulator();
imapClientSimulator.Connect();
imapClientSimulator.Logon(account1.Address, "test");
imapClientSimulator.SelectFolder("INBOX");
Assert.IsTrue(imapClientSimulator.Copy(1, folderName));
Assert.IsTrue(imapClientSimulator.SelectFolder(folderName));
Assert.IsTrue(imapClientSimulator.SetDeletedFlag(1));
Assert.IsFalse(imapClientSimulator.Expunge());
permission.set_Permission(eACLPermission.ePermissionExpunge, true);
permission.Save();
Assert.IsTrue(imapClientSimulator.Expunge());
imapClientSimulator.Disconnect();
}
示例15: TestListPublicFolderAnyonePermission
public void TestListPublicFolderAnyonePermission()
{
Application application = SingletonProvider<TestSetup>.Instance.GetApp();
Account account1 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
Account account2 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
Account account3 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
IMAPFolders publicFolders = _settings.PublicFolders;
IMAPFolder folder = publicFolders.Add("Share1");
folder.Save();
string folderName = "#Public.Share1";
// account 1 should not have permission since they aren't added yet.
var imapClientSimulator = new ImapClientSimulator();
imapClientSimulator.Connect();
imapClientSimulator.Logon(account1.Address, "test");
Assert.IsFalse(imapClientSimulator.List().Contains(folderName));
imapClientSimulator.Disconnect();
IMAPFolderPermission permission = folder.Permissions.Add();
permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone;
permission.set_Permission(eACLPermission.ePermissionCreate, true);
permission.set_Permission(eACLPermission.ePermissionLookup, true);
permission.Save();
// account 1 should not have permission since he's not in the group
imapClientSimulator = new ImapClientSimulator();
imapClientSimulator.Connect();
imapClientSimulator.Logon(account1.Address, "test");
Assert.IsTrue(imapClientSimulator.List().Contains(folderName));
imapClientSimulator.Disconnect();
}