本文整理汇总了C#中RegressionTests.Shared.IMAPClientSimulator.Expunge方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPClientSimulator.Expunge方法的具体用法?C# IMAPClientSimulator.Expunge怎么用?C# IMAPClientSimulator.Expunge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegressionTests.Shared.IMAPClientSimulator
的用法示例。
在下文中一共展示了IMAPClientSimulator.Expunge方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: TestExpunge
public void TestExpunge()
{
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
CustomAssert.IsTrue(SMTPClientSimulator.StaticSend("[email protected]", oAccount.Address, "Test", "test"));
POP3ClientSimulator.AssertMessageCount(oAccount.Address, "test", 1);
var simulator = new IMAPClientSimulator();
simulator.ConnectAndLogon(oAccount.Address, "test");
simulator.SelectFolder("Inbox");
CustomAssert.IsTrue(simulator.SetFlagOnMessage(1, true, @"\Deleted"));
var secondSimulator = new IMAPClientSimulator();
secondSimulator.ConnectAndLogon(oAccount.Address, "test");
string result = secondSimulator.ExamineFolder("INBOX");
CustomAssert.IsTrue(result.Contains("1 EXISTS"), result);
CustomAssert.IsFalse(secondSimulator.Expunge());
simulator.SelectFolder("INBOX");
CustomAssert.IsTrue(simulator.Expunge());
simulator.Close();
secondSimulator.Close();
}
示例3: 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();
}
示例4: 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"));
}
示例5: 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();
}
示例6: TestExpungeNotification
public void TestExpungeNotification()
{
_settings.IMAPIdleEnabled = true;
Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
for (int i = 0; i < 5; i++)
SMTPClientSimulator.StaticSend("[email protected]", oAccount.Address, "Test", "test");
POP3ClientSimulator.AssertMessageCount(oAccount.Address, "test", 5);
var oSimulator1 = new IMAPClientSimulator();
var oSimulator2 = new IMAPClientSimulator();
oSimulator1.ConnectAndLogon(oAccount.Address, "test");
oSimulator2.ConnectAndLogon(oAccount.Address, "test");
oSimulator1.SelectFolder("Inbox");
oSimulator2.SelectFolder("Inbox");
for (int i = 1; i <= 5; i++)
{
CustomAssert.IsTrue(oSimulator1.SetFlagOnMessage(i, true, @"\Deleted"));
}
string noopResponse = oSimulator2.NOOP() + oSimulator2.NOOP();
CustomAssert.IsTrue(noopResponse.Contains(@"* 1 FETCH (FLAGS (\Deleted)") &&
noopResponse.Contains(@"* 1 FETCH (FLAGS (\Deleted)") &&
noopResponse.Contains(@"* 1 FETCH (FLAGS (\Deleted)") &&
noopResponse.Contains(@"* 1 FETCH (FLAGS (\Deleted)") &&
noopResponse.Contains(@"* 1 FETCH (FLAGS (\Deleted)"), noopResponse);
bool result = oSimulator1.Expunge();
string expungeResult = oSimulator2.NOOP() + oSimulator2.NOOP();
CustomAssert.IsTrue(
expungeResult.Contains("* 1 EXPUNGE\r\n* 1 EXPUNGE\r\n* 1 EXPUNGE\r\n* 1 EXPUNGE\r\n* 1 EXPUNGE"),
expungeResult);
}
示例7: TestExpunge
public void TestExpunge()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]",
"test");
for (int i = 0; i < 3; i++)
SMTPClientSimulator.StaticSend("[email protected]", account.Address, "Test", "test");
POP3ClientSimulator.AssertMessageCount(account.Address, "test", 3);
var simulator = new IMAPClientSimulator();
CustomAssert.IsTrue(simulator.ConnectAndLogon(account.Address, "test"));
CustomAssert.IsTrue(simulator.SelectFolder("Inbox"));
CustomAssert.IsTrue(simulator.SetFlagOnMessage(1, true, @"\Deleted"));
CustomAssert.IsTrue(simulator.SetFlagOnMessage(3, true, @"\Deleted"));
string result;
CustomAssert.IsTrue(simulator.Expunge(out result));
// Messages 1 and 2 should be deleted. 2, because when the first message
// is deleted, the index of the message which was originally 3, is now 2.
CustomAssert.IsTrue(result.Contains("* 1 EXPUNGE\r\n* 2 EXPUNGE"));
}