public void EncodeSingleMailAddress_WithAddressAndDisplayName_ShouldEncodeAsDisplayNameAndAddressInBrackets() { MailAddress testAddress = new MailAddress("*****@*****.**", "test"); string result = testAddress.Encode(0, false); Assert.Equal("\"test\" <*****@*****.**>", result); result = testAddress.Encode(0, true); Assert.Equal("\"test\" <*****@*****.**>", result); }
public void EncodeSingleMailAddress_WithAddressAndUnicode_AndPaddingValueOfNonZero_ShouldEncodeCorrectly() { MailAddress testAddress = new MailAddress("*****@*****.**", "jeff \u00C3\u00DA\u00EA\u00EB\u00EF\u00EF"); string result = testAddress.Encode(2, false); Assert.Equal("=?utf-8?Q?jeff_=C3=83=C3=9A=C3=AA=C3=AB=C3=AF=C3=AF?= <*****@*****.**>", result); result = testAddress.Encode(2, true); Assert.Equal("\"jeff \u00C3\u00DA\u00EA\u00EB\u00EF\u00EF\" <*****@*****.**>", result); }
public void EncodeSingleMailAddress_WithAddressAndDisplayNameUnicode_ShouldQEncode() { MailAddress testAddress = new MailAddress("*****@*****.**", "test\u00DC"); string result = testAddress.Encode(0, false); Assert.Equal("=?utf-8?Q?test=C3=9C?= <*****@*****.**>", result); result = testAddress.Encode(0, true); Assert.Equal("\"test\u00DC\" <*****@*****.**>", result); }
public void EncodeSingleMailAddress_WithAddressAndNoUnicode_AndPaddingValueOfNonZero_ShouldEncodeCorrectly() { MailAddress testAddress = new MailAddress("*****@*****.**"); string result = testAddress.Encode(2, false); Assert.Equal("*****@*****.**", result); result = testAddress.Encode(2, true); Assert.Equal("*****@*****.**", result); }
public void EncodeSingleMailAddress_WithAddressAndNonAsciiAndRangeOfChars_ShouldQEncode() { MailAddress testAddress = new MailAddress("*****@*****.**", "\u00AE !#$%&'()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); string result = testAddress.Encode(0, false); Assert.Equal("=?utf-8?Q?test=C3=9Ctesttesttesttesttesttesttesttesttestte?=" + " =?utf-8?Q?sttesttesttesttesttesttesttesttest?= <*****@*****.**>", result); result = testAddress.Encode(0, true); Assert.Equal( "\"\u00AE !#$%&'()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\" " + "<*****@*****.**>", result); }
public void EncodeSingleMailAddress_WithAddressAndNonAsciiAndRangeOfChars_ShouldQEncode() { MailAddress testAddress = new MailAddress("*****@*****.**", "\u00AE !#$%&'()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); string result = testAddress.Encode(0, false); Assert.Equal("=?utf-8?Q?=C2=AE_=21=23=24=25=26=27=28=29=2B=2C=2D=2E=2F0123456789=3A?=" + "\r\n =?utf-8?Q?=3B=3C=3D=3E=3F=40ABCDEFGHIJKLMNOPQRSTUVWXYZ=5B=5C=5D=5E=5F?=" + "\r\n =?utf-8?Q?=60abcdefghijklmnopqrstuvwxyz=7B=7C=7D=7E?= <*****@*****.**>", result); result = testAddress.Encode(0, true); Assert.Equal( "\"\u00AE !#$%&'()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\" " + "<*****@*****.**>", result); }
public void EncodeSingleMailAddress_WithAddressOnly_ShouldEncodeAsAddress() { MailAddress testAddress = new MailAddress("*****@*****.**"); string result = testAddress.Encode(0, false); Assert.Equal("*****@*****.**", result); }