System.Text.Tests.StringBuilderTests.Replace_Char_Invalid C# (CSharp) Method

Replace_Char_Invalid() private method

private Replace_Char_Invalid ( ) : void
return void
        public static void Replace_Char_Invalid()
        {
            var builder = new StringBuilder("Hello");
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => builder.Replace('a', 'b', -1, 0)); // Start index < 0
            Assert.Throws<ArgumentOutOfRangeException>("count", () => builder.Replace('a', 'b', 0, -1)); // Count < 0

            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => builder.Replace('a', 'b', 6, 0)); // Count + start index > builder.Length
            Assert.Throws<ArgumentOutOfRangeException>("count", () => builder.Replace('a', 'b', 5, 1)); // Count + start index > builder.Length
            Assert.Throws<ArgumentOutOfRangeException>("count", () => builder.Replace('a', 'b', 4, 2)); // Count + start index > builder.Length
        }
StringBuilderTests