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