public GetMessageCount ( string sFolder ) : int | ||
sFolder | string | |
Résultat | int |
public static void AssertMessageCount(string accountName, string accountPassword, string folderName, int expectedCount) { if (expectedCount == 0) { // make sure that we aren't currently delivering messages. Utilities.AssertRecipientsInDeliveryQueue(0); } IMAPSimulator oIMAP = new IMAPSimulator(); Assert.IsTrue(oIMAP.ConnectAndLogon(accountName, accountPassword)); if (expectedCount != 0) { oIMAP.AssertFolderExists(folderName); } int currentCount = 0; int timeout = 1000; // 1000 * 25 = 25 seconds. while (timeout > 0) { currentCount = oIMAP.GetMessageCount(folderName); if (currentCount > expectedCount) { break; } if (currentCount == expectedCount) { oIMAP.Disconnect(); return; } timeout--; Thread.Sleep(25); } oIMAP.Disconnect(); string error = "Wrong number of messages in mailbox " + folderName + " in account " + accountName + " Actual: " + currentCount.ToString() + " Expected: " + expectedCount.ToString(); Assert.Fail(error); }
public static void AssertMessageCount(string accountName, string accountPassword, string folderName, int expectedCount) { if (expectedCount == 0) { // make sure that we aren't currently delivering messages. Utilities.AssertRecipientsInDeliveryQueue(0); } IMAPSimulator oIMAP = new IMAPSimulator(); Assert.IsTrue(oIMAP.ConnectAndLogon(accountName, accountPassword)); if (expectedCount != 0) oIMAP.AssertFolderExists(folderName); int currentCount = 0; int timeout = 1000; // 1000 * 25 = 25 seconds. while (timeout > 0) { currentCount = oIMAP.GetMessageCount(folderName); if (currentCount > expectedCount) break; if (currentCount == expectedCount) { oIMAP.Disconnect(); return; } timeout--; Thread.Sleep(25); } oIMAP.Disconnect(); string error = "Wrong number of messages in mailbox " + folderName + " in account " + accountName + " Actual: " + currentCount.ToString() + " Expected: " + expectedCount.ToString(); Assert.Fail(error); }