private static void TestNavigator(
            string code,
            Func<ITextStructureNavigator, SnapshotSpan, SnapshotSpan> func,
            int startPosition,
            int startLength,
            int endPosition,
            int endLength,
            CSharpParseOptions options)
        {
            using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromFile(code, options))
            {
                var buffer = workspace.Documents.First().GetTextBuffer();

                var provider = new TextStructureNavigatorProvider(
                    workspace.GetService<ITextStructureNavigatorSelectorService>(),
                    workspace.GetService<IContentTypeRegistryService>(),
                    workspace.GetService<IWaitIndicator>());

                var navigator = provider.CreateTextStructureNavigator(buffer);

                var actualSpan = func(navigator, new SnapshotSpan(buffer.CurrentSnapshot, startPosition, startLength));
                var expectedSpan = new SnapshotSpan(buffer.CurrentSnapshot, endPosition, endLength);
                Assert.Equal(expectedSpan, actualSpan.Span);
            }
        }
        private static void AssertExtent(string code, int pos, bool isSignificant, int start, int length, CSharpParseOptions options)
        {
            using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromFile(code, options))
            {
                var buffer = workspace.Documents.First().GetTextBuffer();

                var provider = new TextStructureNavigatorProvider(
                    workspace.GetService<ITextStructureNavigatorSelectorService>(),
                    workspace.GetService<IContentTypeRegistryService>(),
                    workspace.GetService<IWaitIndicator>());

                var navigator = provider.CreateTextStructureNavigator(buffer);

                var extent = navigator.GetExtentOfWord(new SnapshotPoint(buffer.CurrentSnapshot, pos));
                Assert.Equal(isSignificant, extent.IsSignificant);

                var expectedSpan = new SnapshotSpan(buffer.CurrentSnapshot, start, length);
                Assert.Equal(expectedSpan, extent.Span);
            }
        }