Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Specs for the Pop3Server
using System.Spec;
using FluentAssertions;
using LumiSoft.Net;
using LumiSoft.Net.Mail;
using LumiSoft.Net.POP3.Client;
using MockEmail.Specs.Properties;
namespace MockEmail.Specs
{
public class MockEmailServerSpec : Specification
{
protected override void Define()
{
Describe("Mock POP3 Server", () =>
{
Pop3Server server = null;
BeforeAll(() => {
server = new Pop3Server(Resources.EmailMessage);
server.Start();
});
It("should get message with LumiSoft.Net", () =>
{
using (var c = new POP3_Client()) {
c.Connect("localhost", WellKnownPorts.POP3);
c.Login("test", "test");
var message = c.Messages[0];
message.Should().NotBeNull();
var mailMessage = Mail_Message.ParseFromByte(message.MessageToByte());
mailMessage.From[0].Address.Should().Be("dzs@iname.com");
}
});
It("should get a message with AE.Net.Mail", () =>
{
using (var pop = new AE.Net.Mail.Pop3Client("localhost", "test", "test")) {
var message = pop.GetMessage(0);
message.From.Address.Should().Be("dzs@iname.com");
}
});
It("should get a message with OpenPop.NET", () =>
{
using (var client = new OpenPop.Pop3.Pop3Client()) {
client.Connect("localhost", 110, false);
client.Authenticate("test", "test");
var message = client.GetMessage(1).ToMailMessage();
message.From.Address.Should().Be("dzs@iname.com");
}
});
AfterAll(() => server.Dispose());
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment