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

AppendLine_NoSpareCapacity_ThrowsArgumentOutOfRangeException() private method

        public static void AppendLine_NoSpareCapacity_ThrowsArgumentOutOfRangeException()
        {
            var builder = new StringBuilder(0, 5);
            builder.Append("Hello");

            Assert.Throws<ArgumentOutOfRangeException>("valueCount", () => builder.AppendLine()); // New length > builder.MaxCapacity
            Assert.Throws<ArgumentOutOfRangeException>("valueCount", () => builder.AppendLine("a")); // New length > builder.MaxCapacity
        }
StringBuilderTests