Extends Verify to allow verification of MailMessage and related types.
See Milestones for release notes.
https://nuget.org/packages/Verify.MailMessage/
[ModuleInitializer]
public static void Initialize() =>
VerifyMailMessage.Initialize();
[Fact]
public Task ContentDisposition()
{
var content = new ContentDisposition("attachment; filename=\"filename.jpg\"");
return Verify(content);
}
Results in:
{
DispositionType: attachment,
FileName: filename.jpg
}
[Fact]
public Task ContentType()
{
var content = new ContentType("text/html; charset=utf-8")
{
Name = "name.txt"
};
return Verify(content);
}
Results in:
{
MediaType: text/html,
Name: name.txt,
CharSet: utf-8
}
[Fact]
public Task Attachment()
{
var attachment = new Attachment(
new MemoryStream("file content"u8.ToArray()),
new ContentType("text/html; charset=utf-8"))
{
Name = "name.txt"
};
return Verify(attachment);
}
Results in:
{
Name: name.txt,
ContentType: {
MediaType: text/html,
Name: name.txt,
CharSet: utf-8
},
ContentId: Guid_1,
ContentDisposition: {
DispositionType: attachment
}
}
[Fact]
public Task MailMessage()
{
var mail = new MailMessage(
from: "[email protected]",
to: "[email protected]",
subject: "The subject",
body: "The body");
return Verify(mail);
}
Results in:
{
From: [email protected],
To: [email protected],
Subject: The subject,
IsBodyHtml: false,
Body: The body
}
Mail from The Noun Project.