public void AddSimple() { var textBuffer = CreateTextBuffer("A𠈓C"); var point = new SnapshotCodePoint(textBuffer.GetStartPoint()); AssertIt(point.Add(1), codePointInfo: CodePointInfo.SurrogatePairHighCharacter, text: "𠈓", position: 1); AssertIt(point.Add(2), codePointInfo: CodePointInfo.SimpleCharacter, text: "C", position: 3); AssertIt(point.Add(3), codePointInfo: CodePointInfo.EndPoint); }
public void AddPastEnd() { var textBuffer = CreateTextBuffer("A𠈓C"); var point = new SnapshotCodePoint(textBuffer.GetStartPoint()); Assert.Throws <ArgumentOutOfRangeException>(() => point.Add(4)); }
public void AddAcrossLines() { var textBuffer = CreateTextBuffer("cat", "dog"); var point1 = new SnapshotCodePoint(textBuffer.GetStartPoint()); var point2 = point1.Add(5); Assert.Equal(1, point2.Line.LineNumber); }
public void AddKeepsLineReference() { var textBuffer = CreateTextBuffer("cat", "dog"); var point = new SnapshotCodePoint(textBuffer.GetStartPoint()); var line = point.Line; for (int i = 0; i < 3; i++) { point = point.Add(1); Assert.Same(line, point.Line); } }