System.Text.Tests.StringBuilderTests.Append_String_Invalid C# (CSharp) Метод

Append_String_Invalid() приватный Метод

private Append_String_Invalid ( ) : void
Результат void
        public static void Append_String_Invalid()
        {
            var builder = new StringBuilder(0, 5);
            builder.Append("Hello");

            Assert.Throws<ArgumentNullException>("value", () => builder.Append((string)null, 1, 1)); // Value is null, startIndex > 0 and count > 0

            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => builder.Append("", -1, 0)); // Start index < 0
            Assert.Throws<ArgumentOutOfRangeException>("count", () => builder.Append("", 0, -1)); // Count < 0

            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => builder.Append("hello", 5, 1)); // Start index + count > value.Length
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => builder.Append("hello", 4, 2)); // Start index + count > value.Length

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