public static IEnumerable<object[]> GetAscii_Invalid_TestData()
{
// Unicode is null
yield return new object[] { null, 0, 0, typeof(ArgumentNullException) };
yield return new object[] { null, -5, -10, typeof(ArgumentNullException) };
// Index or count are invalid
yield return new object[] { "abc", -1, 0, typeof(ArgumentOutOfRangeException) };
yield return new object[] { "abc", 0, -1, typeof(ArgumentOutOfRangeException) };
yield return new object[] { "abc", -5, -10, typeof(ArgumentOutOfRangeException) };
yield return new object[] { "abc", 2, 2, typeof(ArgumentOutOfRangeException) };
yield return new object[] { "abc", 4, 99, typeof(ArgumentOutOfRangeException) };
yield return new object[] { "abc", 3, 0, typeof(ArgumentException) };
// An FQDN/label must not begin with a label separator (it may end with one)
yield return new object[] { "\u0061\u0062\u0063.\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067.\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", 3, 18, typeof(ArgumentException) };
yield return new object[] { "\u0061\u0062\u0063.\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067.\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", 3, 8, typeof(ArgumentException) };
yield return new object[] { "\u0061\u0062\u0063.\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067.\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", 3, 9, typeof(ArgumentException) };
yield return new object[] { "\u0061\u0062\u0063.\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067.\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", 11, 10, typeof(ArgumentException) };
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) // expected platform differences, see https://github.com/dotnet/corefx/issues/8242
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
yield return new object[] { ".", 0, 1, typeof(ArgumentException) };
}
yield return new object[] { "-", 0, 1, typeof(ArgumentException) };
}
else
{
yield return new object[] { ".", 0, 1, typeof(ArgumentException) };
}
// Null containing strings
yield return new object[] { "\u0101\u0000", 0, 2, typeof(ArgumentException) };
yield return new object[] { "\u0101\u0000\u0101", 0, 3, typeof(ArgumentException) };
yield return new object[] { "\u0101\u0000\u0101\u0000", 0, 4, typeof(ArgumentException) };
// Invalid unicode strings
for (int i = 0; i <= 0x1F; i++)
{
yield return new object[] { "abc" + (char)i + "def", 0, 7, typeof(ArgumentException) };
}
yield return new object[] { "abc" + (char)0x7F + "def", 0, 7, typeof(ArgumentException) };
}