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

UrlEncodeToBytes_TestData() public static method

public static UrlEncodeToBytes_TestData ( ) : IEnumerable
return IEnumerable
        public static IEnumerable<object[]> UrlEncodeToBytes_TestData()
        {
            foreach (var tuple in UrlEncode_SharedTestData())
            {
                byte[] input = Encoding.UTF8.GetBytes(tuple.Item1);
                byte[] output = Encoding.UTF8.GetBytes(tuple.Item2);
                yield return new object[] { input, 0, input.Length, output };
            }

            // Nothing to encode
            yield return new object[] { new byte[] { 97 }, 0, 1, new byte[] { 97 } };
            yield return new object[] { new byte[] { 97 }, 1, 0, new byte[0] };
            yield return new object[] { new byte[] { 97, 98, 99 }, 0, 3, new byte[] { 97, 98, 99 } };
            yield return new object[] { new byte[] { 97, 98, 99 }, 1, 2, new byte[] { 98, 99 } };
            yield return new object[] { new byte[] { 97, 98, 99 }, 1, 1, new byte[] { 98 } };
            yield return new object[] { new byte[] { 97, 98, 99, 100 }, 1, 2, new byte[] { 98, 99 } };
            yield return new object[] { new byte[] { 97, 98, 99, 100 }, 2, 2, new byte[] { 99, 100 } };

            // Mixture of ASCII and non-URL safe chars (full and in a range)
            yield return new object[] { new byte[] { 97, 225, 136, 180, 98 }, 0, 5, new byte[] { 97, 37, 69, 49, 37, 56, 56, 37, 66, 52, 98 } };
            yield return new object[] { new byte[] { 97, 225, 136, 180, 98 }, 1, 3, new byte[] { 37, 69, 49, 37, 56, 56, 37, 66, 52 } };

            // Empty
            yield return new object[] { new byte[0], 0, 0, new byte[0] };

            // Null
            yield return new object[] { null, 0, 0, null };
            yield return new object[] { null, int.MinValue, 0, null };
            yield return new object[] { null, int.MaxValue, 0, null };
        }