System.Tests.StringTests.StartsWith_Invalid C# (CSharp) Method

StartsWith_Invalid() private method

private StartsWith_Invalid ( ) : void
return void
        public static void StartsWith_Invalid()
        {
            string s = "Hello";

            // Value is null
            Assert.Throws<ArgumentNullException>("value", () => s.StartsWith(null));
            Assert.Throws<ArgumentNullException>("value", () => s.StartsWith(null, StringComparison.CurrentCultureIgnoreCase));

            Assert.Throws<ArgumentNullException>("value", () => s.StartsWith(null, StringComparison.Ordinal));
            Assert.Throws<ArgumentNullException>("value", () => s.StartsWith(null, StringComparison.OrdinalIgnoreCase));

            // Invalid comparison type
            Assert.Throws<ArgumentException>("comparisonType", () => s.StartsWith("H", StringComparison.CurrentCulture - 1));
            Assert.Throws<ArgumentException>("comparisonType", () => s.StartsWith("H", StringComparison.OrdinalIgnoreCase + 1));
        }
StringTests