Created
April 23, 2013 10:12
-
-
Save alexfalkowski/5442385 to your computer and use it in GitHub Desktop.
Specs for the Pop3Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("[email protected]"); | |
} | |
}); | |
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("[email protected]"); | |
} | |
}); | |
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("[email protected]"); | |
} | |
}); | |
AfterAll(() => server.Dispose()); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment