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

Capacity_Set_Invalid_ThrowsArgumentOutOfRangeException() private method

        public static void Capacity_Set_Invalid_ThrowsArgumentOutOfRangeException()
        {
            var builder = new StringBuilder(10, 10);
            builder.Append("Hello");
            Assert.Throws<ArgumentOutOfRangeException>("value", () => builder.Capacity = -1); // Capacity < 0
            Assert.Throws<ArgumentOutOfRangeException>("value", () => builder.Capacity = builder.MaxCapacity + 1); // Capacity > builder.MaxCapacity
            Assert.Throws<ArgumentOutOfRangeException>("value", () => builder.Capacity = builder.Length - 1); // Capacity < builder.Length
        }
StringBuilderTests