public void TestRemoveThrowsOnNegativeIndexOrCount() { const int anyNegativeIndex = -1; const int anyCount = 1; const int anyValidStartIndex = 0; var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); builder.Invoking(b => b.Remove(anyNegativeIndex, anyCount)) .Should().Throw <ArgumentOutOfRangeException>(); builder.Invoking(b => b.Remove(anyValidStartIndex, anyNegativeIndex)) .Should().Throw <ArgumentOutOfRangeException>(); }
public void TestInsertingAtANegativeIndexThrows() { var builder = new ColoredMultistringBuilder(); builder.Invoking(b => b.Insert(Any.NegativeInt(), 'x')) .Should().Throw <ArgumentOutOfRangeException>(); }
public void TestInsertingAfterEndOfStringThrows() { var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); builder.Invoking(b => b.Insert(builder.Length + 1, anyChar)) .Should().Throw <ArgumentOutOfRangeException>(); }
public void TestAppendingNegativeNumberOfCharsThrows() { const int anyNegativeCount = -1; var builder = new ColoredMultistringBuilder(); builder.Invoking(b => b.Append(anyChar, anyNegativeCount)) .Should().Throw <ArgumentOutOfRangeException>(); }
public void TestCopyToThrowsOnNegativeIndicesOrCounts() { const int anyNegativeIndex = -1; var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); char[] buffer = new char[builder.Length]; builder.Invoking(b => b.CopyTo(anyNegativeIndex, buffer, 0, builder.Length)) .Should().Throw <ArgumentOutOfRangeException>(); builder.Invoking(b => b.CopyTo(0, buffer, anyNegativeIndex, builder.Length)) .Should().Throw <ArgumentOutOfRangeException>(); builder.Invoking(b => b.CopyTo(0, buffer, 0, anyNegativeIndex)) .Should().Throw <ArgumentOutOfRangeException>(); }
public void TestRemoveThrowsOnTooLargeCount() { const int anyValidStartIndex = 0; var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); builder.Invoking(b => b.Remove(anyValidStartIndex, builder.Length + 1)) .Should().Throw <ArgumentOutOfRangeException>(); }
public void TestCopyToThrowsWhenOutputBufferTooSmall() { var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); char[] buffer = new char[1]; builder.Invoking(b => b.CopyTo(0, buffer, 0, builder.Length)) .Should().Throw <ArgumentOutOfRangeException>(); }