public GetMessageCount ( string sUsername, string sPassword ) : int | ||
sUsername | string | |
sPassword | string | |
return | int |
public static void AssertMessageCount(string accountName, string accountPassword, int expectedCount) { if (expectedCount == 0) { // just in case. Utilities.AssertRecipientsInDeliveryQueue(0); } int timeout = 100; int actualCount = 0; while (timeout > 0) { POP3Simulator oPOP3 = new POP3Simulator(); actualCount = oPOP3.GetMessageCount(accountName, accountPassword); if (actualCount == expectedCount) return; if (actualCount > expectedCount) Assert.Fail(string.Format("Actual count exceeds expected count. Account name: {2}, Actual: {0}, Expected: {1}.", actualCount, expectedCount, accountName)); timeout--; Thread.Sleep(50); } Assert.Fail(string.Format("Wrong number of messages in inbox for {0}. Actual: {1}, Expected: {2}", accountName, actualCount, expectedCount)); }
public static void AssertMessageCount(string accountName, string accountPassword, int expectedCount) { if (expectedCount == 0) { // just in case. Utilities.AssertRecipientsInDeliveryQueue(0); } int timeout = 100; int actualCount = 0; while (timeout > 0) { POP3Simulator oPOP3 = new POP3Simulator(); actualCount = oPOP3.GetMessageCount(accountName, accountPassword); if (actualCount == expectedCount) { return; } if (actualCount > expectedCount) { Assert.Fail(string.Format("Actual count exceeds expected count. Account name: {2}, Actual: {0}, Expected: {1}.", actualCount, expectedCount, accountName)); } timeout--; Thread.Sleep(50); } Assert.Fail(string.Format("Wrong number of messages in inbox for {0}. Actual: {1}, Expected: {2}", accountName, actualCount, expectedCount)); }
public static string AssertGetFirstMessageText(string accountName, string accountPassword) { // Wait for the message to appear. POP3Simulator pop3 = new POP3Simulator(); for (int i = 0; i < 5000; i++) { if (pop3.GetMessageCount(accountName, accountPassword) > 0) { break; } Thread.Sleep(20); } // Download it. string text = pop3.GetFirstMessageText(accountName, accountPassword); if (text.Length == 0) { Assert.Fail("Message was found but contents could not be received"); } return(text); }
static void Main(string[] args) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); // Determine message count POP3Simulator pop3sim = new POP3Simulator(); int count = pop3sim.GetMessageCount("*****@*****.**", "test"); // Fetch them.. pop3sim.ConnectAndLogon("*****@*****.**","test"); for (int i = 1; i <= count; i++) { pop3sim.RETR(i); } for (int i = 1; i <= count; i++) { pop3sim.DELE(i); } pop3sim.QUIT(); System.Threading.Thread.Sleep(1000 * 60 * 60); stopwatch.Stop(); Console.WriteLine("Passed time: " + stopwatch.Elapsed.TotalSeconds.ToString()); }
public static string AssertGetFirstMessageText(string accountName, string accountPassword) { // Wait for the message to appear. POP3Simulator pop3 = new POP3Simulator(); for (int i = 0; i < 5000; i++) { if (pop3.GetMessageCount(accountName, accountPassword) > 0) break; Thread.Sleep(20); } // Download it. string text = pop3.GetFirstMessageText(accountName, accountPassword); if (text.Length == 0) Assert.Fail("Message was found but contents could not be received"); return text; }