Skip to content

Commit

Permalink
Added unit test for casting MailboxAddress to MailAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Sep 3, 2021
1 parent b76ce2d commit e93501b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions UnitTests/MailboxAddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ public void TestGarbageAfterAddress ()
}
}

[Test]
public void TestCastToMailAddress ()
{
var mailbox = new MailboxAddress (CharsetUtils.Latin1, "æøå", "user@example.com");
var address = (System.Net.Mail.MailAddress) mailbox;

Assert.AreEqual (mailbox.Address, address.Address, "Address");
Assert.AreEqual (mailbox.Name, address.DisplayName, "DisplayName");
}

static void AssertParseFailure (string text, bool result, int tokenIndex, int errorIndex, RfcComplianceMode mode = RfcComplianceMode.Loose)
{
var buffer = text.Length > 0 ? Encoding.UTF8.GetBytes (text) : new byte[1];
Expand Down

0 comments on commit e93501b

Please sign in to comment.