public void SizeIncreasedWhenMessageReceived() { Domain domain = SingletonProvider <TestSetup> .Instance.AddTestDomain(); Account account = SingletonProvider <TestSetup> .Instance.AddAccount(domain, "*****@*****.**", "test"); string body = TestSetup.CreateLargeDummyMailBody(); // Send a message SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "Test message", body); IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 1); float sizeBefore = account.Size; SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "Test message", body); IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 2); float sizeAfter = account.Size; CustomAssert.Greater(sizeAfter, sizeBefore); }
public void TestLargeMessageSuccess() { CustomAssert.AreEqual(0, _status.UndeliveredMessages.Length); // No valid recipients... var deliveryResults = new Dictionary <string, int>(); deliveryResults["*****@*****.**"] = 250; int smtpServerPort = TestSetup.GetNextFreePort(); using (var server = new SMTPServerSimulator(1, smtpServerPort)) { server.AddRecipientResult(deliveryResults); server.StartListen(); // Add a route so we can connect to localhost. AddRoutePointingAtLocalhost(5, smtpServerPort, false); // Send message to this route. var messageBody = TestSetup.CreateLargeDummyMailBody(); var smtp = new SMTPClientSimulator(); var recipients = new List <string>(); recipients.Add("*****@*****.**"); CustomAssert.IsTrue(smtp.Send("*****@*****.**", recipients, "Test", messageBody)); // Wait for the client to disconnect. server.WaitForCompletion(); CustomAssert.IsTrue(server.Conversation.Contains("\r\nDATA\r\n")); TestSetup.AssertRecipientsInDeliveryQueue(0, false); CustomAssert.IsTrue(server.MessageData.Contains(messageBody)); } }