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

Remove_Invalid() private method

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

            // Start index < 0
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => s.Remove(-1));
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => s.Remove(-1, 0));

            // Start index >= string.Length
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => s.Remove(s.Length));

            // Count < 0
            Assert.Throws<ArgumentOutOfRangeException>("count", () => s.Remove(0, -1));

            // Start index + count > string.Length
            Assert.Throws<ArgumentOutOfRangeException>("count", () => s.Remove(0, s.Length + 1));
            Assert.Throws<ArgumentOutOfRangeException>("count", () => s.Remove(s.Length + 1, 0));
            Assert.Throws<ArgumentOutOfRangeException>("count", () => s.Remove(s.Length, 1));
        }
StringTests