当前位置: 首页>>代码示例>>C#>>正文


C# MailAddress.Encode方法代码示例

本文整理汇总了C#中MailAddress.Encode方法的典型用法代码示例。如果您正苦于以下问题:C# MailAddress.Encode方法的具体用法?C# MailAddress.Encode怎么用?C# MailAddress.Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MailAddress的用法示例。


在下文中一共展示了MailAddress.Encode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EncodeSingleMailAddress_WithAddressAndDisplayName_ShouldEncodeAsDisplayNameAndAddressInBrackets

        public void EncodeSingleMailAddress_WithAddressAndDisplayName_ShouldEncodeAsDisplayNameAndAddressInBrackets()
        {
            MailAddress testAddress = new MailAddress("[email protected]", "test");
            string result = testAddress.Encode(0, false);
            Assert.Equal("\"test\" <[email protected]>", result);

            result = testAddress.Encode(0, true);
            Assert.Equal("\"test\" <[email protected]>", result);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:MailAddressEncodeTest.cs

示例2: EncodeSingleMailAddress_WithAddressAndUnicode_AndPaddingValueOfNonZero_ShouldEncodeCorrectly

        public void EncodeSingleMailAddress_WithAddressAndUnicode_AndPaddingValueOfNonZero_ShouldEncodeCorrectly()
        {
            MailAddress testAddress = new MailAddress("[email protected]", "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?= <[email protected]>", result);

            result = testAddress.Encode(2, true);
            Assert.Equal("\"jeff \u00C3\u00DA\u00EA\u00EB\u00EF\u00EF\" <[email protected]>", result);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:MailAddressEncodeTest.cs

示例3: EncodeSingleMailAddress_WithAddressAndDisplayNameUnicode_ShouldQEncode

        public void EncodeSingleMailAddress_WithAddressAndDisplayNameUnicode_ShouldQEncode()
        {
            MailAddress testAddress = new MailAddress("[email protected]", "test\u00DC");

            string result = testAddress.Encode(0, false);
            Assert.Equal("=?utf-8?Q?test=C3=9C?= <[email protected]>", result);

            result = testAddress.Encode(0, true);
            Assert.Equal("\"test\u00DC\" <[email protected]>", result);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:MailAddressEncodeTest.cs

示例4: EncodeSingleMailAddress_WithAddressAndNoUnicode_AndPaddingValueOfNonZero_ShouldEncodeCorrectly

        public void EncodeSingleMailAddress_WithAddressAndNoUnicode_AndPaddingValueOfNonZero_ShouldEncodeCorrectly()
        {
            MailAddress testAddress = new MailAddress("[email protected]");

            string result = testAddress.Encode(2, false);
            Assert.Equal("[email protected]", result);

            result = testAddress.Encode(2, true);
            Assert.Equal("[email protected]", result);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:MailAddressEncodeTest.cs

示例5: EncodeSingleMailAddress_WithAddressAndNonAsciiAndRangeOfChars_ShouldQEncode

        public void EncodeSingleMailAddress_WithAddressAndNonAsciiAndRangeOfChars_ShouldQEncode()
        {
            MailAddress testAddress = new MailAddress("[email protected]",
                "\u00AE !#$%&'()+,-./0123456789:;<=>[email protected][\\]^_`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?= <[email protected]>", result);

            result = testAddress.Encode(0, true);
            Assert.Equal(
                "\"\u00AE !#$%&'()+,-./0123456789:;<=>[email protected][\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\" "
                + "<[email protected]>", result);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:14,代码来源:MailAddressEncodeTest.cs

示例6: EncodeSingleMailAddress_WithAddressOnly_ShouldEncodeAsAddress

 public void EncodeSingleMailAddress_WithAddressOnly_ShouldEncodeAsAddress()
 {
     MailAddress testAddress = new MailAddress("[email protected]");
     string result = testAddress.Encode(0, false);
     Assert.Equal("[email protected]", result);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:6,代码来源:MailAddressEncodeTest.cs


注:本文中的MailAddress.Encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。