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

Insert_Decimal_Invalid() private method

private Insert_Decimal_Invalid ( ) : void
return void
        public static void Insert_Decimal_Invalid()
        {
            var builder = new StringBuilder(0, 5);
            builder.Append("Hello");

            Assert.Throws<ArgumentOutOfRangeException>("index", () => builder.Insert(-1, (decimal)1)); // Index < 0
            Assert.Throws<ArgumentOutOfRangeException>("index", () => builder.Insert(builder.Length + 1, (decimal)1)); // Index > builder.Length
            Assert.Throws<OutOfMemoryException>(() => builder.Insert(builder.Length, (decimal)1)); // New length > builder.MaxCapacity
        }
StringBuilderTests