本文整理汇总了C#中RegressionTests.Shared.ImapClientSimulator.SetDeletedFlag方法的典型用法代码示例。如果您正苦于以下问题:C# ImapClientSimulator.SetDeletedFlag方法的具体用法?C# ImapClientSimulator.SetDeletedFlag怎么用?C# ImapClientSimulator.SetDeletedFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.ImapClientSimulator
的用法示例。
在下文中一共展示了ImapClientSimulator.SetDeletedFlag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: TestFolderExpungeNotification
public void TestFolderExpungeNotification()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
SmtpClientSimulator.StaticSend(account.Address, account.Address, "TestSubject", "TestBody");
ImapClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);
var simulator1 = new ImapClientSimulator();
var simulator2 = new ImapClientSimulator();
simulator1.ConnectAndLogon(account.Address, "test");
simulator2.ConnectAndLogon(account.Address, "test");
simulator1.SelectFolder("Inbox");
simulator2.SelectFolder("Inbox");
string result = simulator2.NOOP();
Assert.IsFalse(result.Contains("Deleted"));
Assert.IsFalse(result.Contains("Seen"));
simulator1.SetDeletedFlag(1);
simulator1.Expunge();
// the result may (should) come after the first NOOP response stream so do noop twice.
result = simulator2.NOOP() + simulator2.NOOP();
Assert.IsTrue(result.Contains("* 1 EXPUNGE"));
simulator1.Disconnect();
simulator2.Disconnect();
}
示例3: TestFolderUpdateNotification
public void TestFolderUpdateNotification()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
SmtpClientSimulator.StaticSend(account.Address, account.Address, "TestSubject", "TestBody");
ImapClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);
var simulator1 = new ImapClientSimulator();
var simulator2 = new ImapClientSimulator();
simulator1.ConnectAndLogon(account.Address, "test");
simulator2.ConnectAndLogon(account.Address, "test");
simulator1.SelectFolder("Inbox");
simulator2.SelectFolder("Inbox");
string result = simulator2.NOOP() + simulator2.NOOP();
Assert.IsFalse(result.Contains("Deleted"));
Assert.IsFalse(result.Contains("Seen"));
simulator1.SetDeletedFlag(1);
simulator1.SetSeenFlag(1);
result = simulator2.NOOP() + simulator2.NOOP();
Assert.IsTrue(result.Contains("Deleted"));
Assert.IsTrue(result.Contains("Seen"));
simulator1.Disconnect();
simulator2.Disconnect();
}
示例4: TestPublicFolderUpdateNotification
public void TestPublicFolderUpdateNotification()
{
IMAPFolders folders = _application.Settings.PublicFolders;
IMAPFolder folder = folders.Add("Share");
folder.Save();
IMAPFolderPermission permission = folder.Permissions.Add();
permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone;
permission.set_Permission(eACLPermission.ePermissionLookup, true);
permission.set_Permission(eACLPermission.ePermissionRead, true);
permission.set_Permission(eACLPermission.ePermissionWriteOthers, true);
permission.set_Permission(eACLPermission.ePermissionWriteSeen, true);
permission.set_Permission(eACLPermission.ePermissionWriteDeleted, true);
permission.set_Permission(eACLPermission.ePermissionInsert, true);
permission.Save();
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
SmtpClientSimulator.StaticSend(account.Address, account.Address, "TestSubject", "TestBody");
ImapClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);
var simulator1 = new ImapClientSimulator();
var simulator2 = new ImapClientSimulator();
simulator1.ConnectAndLogon(account.Address, "test");
simulator2.ConnectAndLogon(account.Address, "test");
simulator1.SelectFolder("Inbox");
simulator2.SelectFolder("Inbox");
Assert.IsTrue(simulator1.Copy(1, "#Public.Share"));
simulator1.SelectFolder("#Public.Share");
simulator2.SelectFolder("#Public.Share");
string result = simulator2.NOOP() + simulator2.NOOP();
Assert.IsFalse(result.Contains("Deleted"));
Assert.IsFalse(result.Contains("Seen"));
simulator1.SetDeletedFlag(1);
simulator1.SetSeenFlag(1);
result = simulator2.NOOP() + simulator2.NOOP();
Assert.IsTrue(result.Contains("Deleted"));
Assert.IsTrue(result.Contains("Seen"));
simulator1.Disconnect();
simulator2.Disconnect();
}
示例5: TestPOP3TransactionSafety
public void TestPOP3TransactionSafety()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
SmtpClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody");
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 1);
var sim = new Pop3ClientSimulator();
sim.ConnectAndLogon(account.Address, "test");
// Now delete the message using an IMAP client.
var imapSimulator = new ImapClientSimulator();
Assert.IsTrue(imapSimulator.ConnectAndLogon(account.Address, "test"));
Assert.IsTrue(imapSimulator.SelectFolder("INBOX"));
Assert.IsTrue(imapSimulator.SetDeletedFlag(1));
Assert.IsTrue(imapSimulator.Expunge());
Assert.AreEqual(0, imapSimulator.GetMessageCount("Inbox"));
SmtpClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody");
ImapClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);
// This deletion should not have any effect, since the POP3 connection is referencing an old message.
sim.DELE(1);
sim.QUIT();
Assert.AreEqual(1, imapSimulator.GetMessageCount("Inbox"));
}
示例6: TestLogonMailboxWithDeletedMessage
public void TestLogonMailboxWithDeletedMessage()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
for (int i = 1; i <= 3; i++)
SmtpClientSimulator.StaticSend(account.Address, account.Address, "Test",
"Line1\r\nLine2\r\nLine3\r\nLine4\r\nLine\r\n");
// Mark the second message as deleted using IMAP.
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 3);
var sim = new ImapClientSimulator();
sim.ConnectAndLogon(account.Address, "test");
sim.SelectFolder("INBOX");
sim.SetDeletedFlag(2);
sim.Disconnect();
// Now list messages and confirm that all are listed.
var pop3Client = new Pop3ClientSimulator();
pop3Client.ConnectAndLogon(account.Address, "test");
string listResponse = pop3Client.LIST();
string uidlResponse = pop3Client.UIDL();
Assert.IsTrue(listResponse.Contains("\r\n1"));
Assert.IsTrue(listResponse.Contains("\r\n2"));
Assert.IsTrue(listResponse.Contains("\r\n3"));
Assert.IsTrue(listResponse.Contains("\r\n.\r\n"));
Assert.IsTrue(listResponse.Contains("3 messages"));
Assert.IsTrue(uidlResponse.Contains("\r\n1"));
Assert.IsTrue(uidlResponse.Contains("\r\n2"));
Assert.IsTrue(uidlResponse.Contains("\r\n3"));
Assert.IsTrue(uidlResponse.Contains("\r\n.\r\n"));
Assert.IsTrue(uidlResponse.Contains("3 messages"));
}
示例7: TestSearchWithNOTDeleted
public void TestSearchWithNOTDeleted()
{
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]", "TestSubject", "TestBody");
smtpClientSimulator.Send("[email protected]", "[email protected]", "TestSubject", "TestBody");
ImapClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);
var oSimulator = new ImapClientSimulator();
oSimulator.Connect();
oSimulator.Logon("[email protected]", "test");
oSimulator.SelectFolder("Inbox");
oSimulator.SetDeletedFlag(2);
var searchResult = oSimulator.Search("(OR FROM \"TestSubject\" (OR SUBJECT \"TestSubject\" BODY \"TestSubject\")) NOT DELETED");
Assert.AreEqual("1", searchResult);
}
示例8: SetupAccountObject
private void SetupAccountObject(Domain domain)
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(domain, "[email protected]", "test");
// Make sure the inbox contains two messages which should be backed up.
SmtpClientSimulator.StaticSend(account.Address, account.Address, "Message 1 Subject",
"Message 1 Body");
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 1);
SmtpClientSimulator.StaticSend(account.Address, account.Address, "Message 2 Subject",
"Message 2 Body");
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 2);
SmtpClientSimulator.StaticSend(account.Address, account.Address, "Message 3 Subject",
"Message 3 Body");
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 3);
var sim = new ImapClientSimulator();
Assert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
Assert.IsTrue(sim.SelectFolder("Inbox"));
Assert.IsTrue(sim.SetDeletedFlag(2));
Assert.IsTrue(sim.Expunge());
sim.Disconnect();
_folderCreationTime = account.IMAPFolders.get_ItemByName("INBOX").CreationTime;
account.Active = true;
account.ADDomain = "AD";
account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
account.ADUsername = "AU";
account.ForwardAddress = "FA";
account.ForwardEnabled = false;
account.ForwardKeepOriginal = true;
account.IsAD = false;
account.MaxSize = 1250;
account.PersonFirstName = "First";
account.PersonLastName = "Last";
account.SignatureEnabled = true;
account.SignatureHTML = "HTML";
account.SignaturePlainText = "PLAIN";
account.VacationMessage = "VAC";
account.VacationMessageExpires = true;
account.VacationMessageExpiresDate = "2020-01-01";
account.VacationMessageIsOn = true;
account.VacationSubject = "SUBJ";
account.Password = "test";
account.Save();
// Set up fetch account
FetchAccount fa = account.FetchAccounts.Add();
fa.DaysToKeepMessages = 5;
fa.Enabled = true;
fa.MinutesBetweenFetch = 10;
fa.Name = "test";
fa.Port = _fetchAccountPort;
fa.ProcessMIMEDate = true;
fa.ProcessMIMERecipients = true;
fa.ServerAddress = "127.0.0.1";
fa.Username = "test";
fa.UseSSL = false;
fa.UseAntiSpam = true;
fa.UseAntiVirus = true;
fa.Save();
DownloadFromExternalAccount(account, fa);
Rule rule = account.Rules.Add();
rule.Name = "MyRule";
RuleCriteria criteria = rule.Criterias.Add();
criteria.MatchType = eRuleMatchType.eMTGreaterThan;
criteria.PredefinedField = eRulePredefinedField.eFTMessageSize;
criteria.MatchValue = "0";
criteria.Save();
RuleAction action = rule.Actions.Add();
action.Type = eRuleActionType.eRAForwardEmail;
action.To = "[email protected]";
action.Body = "Test";
action.Filename = "File";
action.FromAddress = "T";
action.FromName = "N";
action.HeaderName = "H";
action.IMAPFolder = "Folder";
action.ScriptFunction = "Script";
action.Subject = "Subj";
action.Value = "Value";
action.Save();
rule.Save();
}