本文整理汇总了C#中RegressionTests.Shared.IMAPClientSimulator.SetDeletedFlag方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPClientSimulator.SetDeletedFlag方法的具体用法?C# IMAPClientSimulator.SetDeletedFlag怎么用?C# IMAPClientSimulator.SetDeletedFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.IMAPClientSimulator
的用法示例。
在下文中一共展示了IMAPClientSimulator.SetDeletedFlag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
TestSetup.AssertFolderMessageCount(account1.IMAPFolders.get_ItemByName("INBOX"), 1);
TestSetup.AssertFolderMessageCount(folder, 0);
var oSimulator1 = new IMAPClientSimulator();
oSimulator1.Connect();
oSimulator1.Logon(account1.Address, "test");
oSimulator1.SelectFolder("INBOX");
CustomAssert.IsTrue(oSimulator1.Copy(1, folderName));
CustomAssert.IsTrue(oSimulator1.SelectFolder(folderName));
CustomAssert.IsTrue(oSimulator1.SetDeletedFlag(1));
CustomAssert.IsFalse(oSimulator1.Expunge());
permission.set_Permission(eACLPermission.ePermissionExpunge, true);
permission.Save();
CustomAssert.IsTrue(oSimulator1.Expunge());
oSimulator1.Disconnect();
}
示例2: 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.
CustomAssert.IsTrue(SMTPClientSimulator.StaticSend(account.Address, account.Address, "Message 1 Subject",
"Message 1 Body"));
POP3ClientSimulator.AssertMessageCount(account.Address, "test", 1);
CustomAssert.IsTrue(SMTPClientSimulator.StaticSend(account.Address, account.Address, "Message 2 Subject",
"Message 2 Body"));
POP3ClientSimulator.AssertMessageCount(account.Address, "test", 2);
CustomAssert.IsTrue(SMTPClientSimulator.StaticSend(account.Address, account.Address, "Message 3 Subject",
"Message 3 Body"));
POP3ClientSimulator.AssertMessageCount(account.Address, "test", 3);
var sim = new IMAPClientSimulator();
CustomAssert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
CustomAssert.IsTrue(sim.SelectFolder("Inbox"));
CustomAssert.IsTrue(sim.SetDeletedFlag(2));
CustomAssert.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();
}
示例3: TestPOP3TransactionSafety
public void TestPOP3TransactionSafety()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
CustomAssert.IsTrue(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();
CustomAssert.IsTrue(imapSimulator.ConnectAndLogon(account.Address, "test"));
CustomAssert.IsTrue(imapSimulator.SelectFolder("INBOX"));
CustomAssert.IsTrue(imapSimulator.SetDeletedFlag(1));
CustomAssert.IsTrue(imapSimulator.Expunge());
CustomAssert.AreEqual(0, imapSimulator.GetMessageCount("Inbox"));
CustomAssert.IsTrue(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();
CustomAssert.AreEqual(1, imapSimulator.GetMessageCount("Inbox"));
}
示例4: 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();
CustomAssert.IsTrue(listResponse.Contains("\r\n1"));
CustomAssert.IsTrue(listResponse.Contains("\r\n2"));
CustomAssert.IsTrue(listResponse.Contains("\r\n3"));
CustomAssert.IsTrue(listResponse.Contains("\r\n.\r\n"));
CustomAssert.IsTrue(listResponse.Contains("3 messages"));
CustomAssert.IsTrue(uidlResponse.Contains("\r\n1"));
CustomAssert.IsTrue(uidlResponse.Contains("\r\n2"));
CustomAssert.IsTrue(uidlResponse.Contains("\r\n3"));
CustomAssert.IsTrue(uidlResponse.Contains("\r\n.\r\n"));
CustomAssert.IsTrue(uidlResponse.Contains("3 messages"));
}
示例5: 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();
CustomAssert.IsFalse(result.Contains("Deleted"));
CustomAssert.IsFalse(result.Contains("Seen"));
simulator1.SetDeletedFlag(1);
simulator1.SetSeenFlag(1);
result = simulator2.NOOP() + simulator2.NOOP();
CustomAssert.IsTrue(result.Contains("Deleted"));
CustomAssert.IsTrue(result.Contains("Seen"));
simulator1.Disconnect();
simulator2.Disconnect();
}
示例6: 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();
CustomAssert.IsFalse(result.Contains("Deleted"));
CustomAssert.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();
CustomAssert.IsTrue(result.Contains("* 1 EXPUNGE"));
simulator1.Disconnect();
simulator2.Disconnect();
}
示例7: 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");
CustomAssert.IsTrue(simulator1.Copy(1, "#Public.Share"));
simulator1.SelectFolder("#Public.Share");
simulator2.SelectFolder("#Public.Share");
string result = simulator2.NOOP() + simulator2.NOOP();
CustomAssert.IsFalse(result.Contains("Deleted"));
CustomAssert.IsFalse(result.Contains("Seen"));
simulator1.SetDeletedFlag(1);
simulator1.SetSeenFlag(1);
result = simulator2.NOOP() + simulator2.NOOP();
CustomAssert.IsTrue(result.Contains("Deleted"));
CustomAssert.IsTrue(result.Contains("Seen"));
simulator1.Disconnect();
simulator2.Disconnect();
}