Example #1
0
        private void VerifyTags(ITextSnapshot snapshot, IEnumerable <ITagSpan <IOutliningRegionTag> > tags, params ExpectedTag[] expected)
        {
            var ltags = new List <ITagSpan <IOutliningRegionTag> >(tags);

            // Print this out so we can easily update the tests if things change.
            foreach (var tag in ltags)
            {
                int start = tag.Span.Start.Position;
                int end   = tag.Span.End.Position;
                Console.WriteLine("new ExpectedTag({0}, {1}, \"{2}\"),",
                                  start,
                                  end,
                                  Classification.FormatString(snapshot.GetText(Span.FromBounds(start, end)))
                                  );
            }


            Assert.AreEqual(expected.Length, ltags.Count);

            for (int i = 0; i < ltags.Count; i++)
            {
                int start = ltags[i].Span.Start.Position;
                int end   = ltags[i].Span.End.Position;
                Assert.AreEqual(expected[i].Start, start);
                Assert.AreEqual(expected[i].End, end);
                Assert.AreEqual(expected[i].Text, snapshot.GetText(Span.FromBounds(start, end)));
                Assert.AreEqual(ltags[i].Tag.IsImplementation, true);
            }
        }
Example #2
0
        private void VerifyTags(ITextBuffer buffer, IEnumerable <IMappingTagSpan <IOutliningRegionTag> > tags, params ExpectedTag[] expected)
        {
            var ltags = new List <IMappingTagSpan <IOutliningRegionTag> >(tags);

            foreach (var tag in ltags)
            {
                int start = tag.Span.Start.GetInsertionPoint(x => x == buffer).Value.Position;
                int end   = tag.Span.End.GetInsertionPoint(x => x == buffer).Value.Position;
                Console.WriteLine("new ExpectedTag({0}, {1}, \"{2}\"),",
                                  start,
                                  end,
                                  Classification.FormatString(buffer.CurrentSnapshot.GetText(Span.FromBounds(start, end)))
                                  );
            }
            Assert.AreEqual(expected.Length, ltags.Count);

            for (int i = 0; i < ltags.Count; i++)
            {
                int start = ltags[i].Span.Start.GetInsertionPoint(x => x == buffer).Value.Position;
                int end   = ltags[i].Span.End.GetInsertionPoint(x => x == buffer).Value.Position;
                Assert.AreEqual(expected[i].Start, start);
                Assert.AreEqual(expected[i].End, end);
                Assert.AreEqual(expected[i].Text, buffer.CurrentSnapshot.GetText(Span.FromBounds(start, end)));
                Assert.AreEqual(ltags[i].Tag.IsImplementation, true);
            }
        }