public static unsafe void Append_CharPointer_Invalid()
{
var builder = new StringBuilder();
Assert.Throws<NullReferenceException>(() => builder.Append(null, 2)); // Value is null
builder = new StringBuilder(0, 5);
builder.Append("Hello");
Assert.Throws<ArgumentOutOfRangeException>("valueCount", () =>
{
fixed (char* value = new char[0]) { builder.Append(value, -1); } // Value count < 0
});
Assert.Throws<ArgumentOutOfRangeException>("valueCount", () =>
{
fixed (char* value = new char[] { 'a' }) { builder.Append(value, 1); } // New length > builder.MaxCapacity
});
}