Skip to content

Commit

Permalink
Added more unit tests for ImapEncodings
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Sep 14, 2023
1 parent 73ddd22 commit 6aca021
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions UnitTests/Net/Imap/ImapEncodingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ namespace UnitTests.Net.Imap {
[TestFixture]
public class ImapEncodingTests
{
[Test]
public void TestAmpersand ()
{
const string text = "Jack & Jill";

var encoded = ImapEncoding.Encode (text);
Assert.AreEqual ("Jack &- Jill", encoded, "UTF-7 encoded text does not match the expected value: {0}", encoded);

var decoded = ImapEncoding.Decode (encoded);
Assert.AreEqual (text, decoded, "UTF-7 decoded text does not match the original text: {0}", decoded);
}

[Test]
public void TestArabicExample ()
{
Expand Down Expand Up @@ -105,6 +117,15 @@ public void TestDecodeBadRfc3501Example ()
Assert.AreEqual (encoded, decoded, "UTF-7 decoded text does not match the original text: {0}", decoded);
}

[Test]
public void TestDecodeInvalidUtf7 ()
{
const string encoded = "&台北日本語";

var decoded = ImapEncoding.Decode (encoded);
Assert.AreEqual (encoded, decoded, "UTF-7 decoded text does not match the original text: {0}", decoded);
}

[Test]
public void TestRfc3501SuperfluousShiftExample ()
{
Expand Down

0 comments on commit 6aca021

Please sign in to comment.