System.Net.Tests.WebUtilityTests.HtmlEncode_TestData C# (CSharp) Method

HtmlEncode_TestData() public static method

public static HtmlEncode_TestData ( ) : IEnumerable
return IEnumerable
        public static IEnumerable<object[]> HtmlEncode_TestData()
        {
            // Single quotes need to be encoded as &#39; rather than &apos; since &#39; is valid both for
            // HTML and XHTML, but &apos; is valid only for XHTML.
            // For more info: http://fishbowl.pastiche.org/2003/07/01/the_curse_of_apos/
            yield return new object[] { "'", "&#39;" };

            yield return new object[] { "Hello! '\"<&>\u2665\u00E7 World", "Hello! &#39;&quot;&lt;&amp;&gt;\u2665&#231; World" };
            yield return new object[] { "<>\"\\&", "&lt;&gt;&quot;\\&amp;" };
            yield return new object[] { "\u00A0", "&#160;" };
            yield return new object[] { "\u00FF", "&#255;" };
            yield return new object[] { "\u0100", "\u0100" };
            yield return new object[] { "\u0021\u0023\u003D\u003F", "!#=?" };

            // Surrogate pairs - default strict settings
            yield return new object[] { char.ConvertFromUtf32(144308), "&#144308;" };
            yield return new object[] { "\uD800\uDC00", "&#65536;" };
            yield return new object[] { "a\uD800\uDC00b", "a&#65536;b" };

            // High BMP non-chars
            yield return new object[] { "\uFFFD", "\uFFFD" };
            yield return new object[] { "\uFFFE", "\uFFFE" };
            yield return new object[] { "\uFFFF", "\uFFFF" };

            // Lone high surrogate
            yield return new object[] { "\uD800", "\uFFFD" };
            yield return new object[] { "\uD800a", "\uFFFDa" };

            // Lone low surrogate
            yield return new object[] { "\uDC00", "\uFFFD" };
            yield return new object[] { "\uDC00a", "\uFFFDa" };

            // Invalid surrogate pair
            yield return new object[] { "\uD800\uD800", "\uFFFD\uFFFD" }; // High, high
            yield return new object[] { "\uDC00\uD800", "\uFFFD\uFFFD" }; // Low, high
            yield return new object[] { "\uDC00\uDC00", "\uFFFD\uFFFD" }; // Low, low

            // Basic
            yield return new object[] { "Hello, world!", "Hello, world!" };
            yield return new object[] { "    ", "    " };

            // Empty string
            yield return new object[] { "", "" };
            yield return new object[] { null, null };
        }