예제 #1
0
            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);
            }
예제 #2
0
            public void AddPastEnd()
            {
                var textBuffer = CreateTextBuffer("A𠈓C");
                var point      = new SnapshotCodePoint(textBuffer.GetStartPoint());

                Assert.Throws <ArgumentOutOfRangeException>(() => point.Add(4));
            }
예제 #3
0
            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);
            }
예제 #4
0
            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);
                }
            }