public void TestTruncationToZeroLengthDropsContent() { var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); builder.Truncate(0); builder.ShouldBeEmpty(); }
public void TestTruncationToTooLongLengthThrows() { var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); Action truncate = () => builder.Truncate(builder.Length + 1); truncate.Should().Throw <ArgumentOutOfRangeException>(); }
public void TestTruncationThrowsOnNegativeLength() { const int anyNegativeLength = -1; var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); Action truncate = () => builder.Truncate(anyNegativeLength); truncate.Should().Throw <ArgumentOutOfRangeException>(); }
public void TestTruncationTrimsContentFromLastPiece() { var anyFirstCs = AnyColoredString("ab"); var anySecondCs = AnyColoredString("cde"); var builder = new ColoredMultistringBuilder(); builder.Append(new[] { anyFirstCs, anySecondCs }); builder.Truncate(3); builder.ShouldProduce( anyFirstCs, anySecondCs.WithContent("c")); }