public void TestStringInsertionAtEndOfBuilder() { var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); builder.Insert(builder.Length, anyString); builder.ShouldProduce( anyArrayOfMultipleColoredStrings.Concat(new ColoredString[] { anyString })); }
public void TestStringInsertionAtStartOfBuilder() { var builder = new ColoredMultistringBuilder(); builder.Append(anyArrayOfMultipleColoredStrings); builder.Insert(0, anyString); builder.ShouldProduce( new ColoredString[] { anyString }.Concat(anyArrayOfMultipleColoredStrings)); }
public void TestStringInsertionInMiddleOfPieceWithSameColor() { var cs = new ColoredString("abc"); var builder = new ColoredMultistringBuilder(); builder.Append(cs); builder.Insert(1, "de"); builder.ShouldProduce("adebc"); }
public void TestStringInsertionInMiddleOfPieceWithDifferentColor() { var cs = AnyColoredString("abc"); var builder = new ColoredMultistringBuilder(); builder.Append(cs); builder.Insert(1, "de"); builder.ShouldProduce( cs.Transform(_ => "a"), "de", cs.Transform(_ => "bc")); }
public void TestCharInsertionInMiddleOfPieceWithDifferentColor() { var cs = AnyColoredString("abc"); var builder = new ColoredMultistringBuilder(); builder.Append(cs); builder.Insert(1, 'x'); builder.ShouldProduce( cs.WithContent("a"), new ColoredString("x"), cs.WithContent("bc")); }