protected async Task AssertNavigatedAsync(string code, bool next, SourceCodeKind?sourceCodeKind = null)
        {
            var kinds = sourceCodeKind != null
                ? SpecializedCollections.SingletonEnumerable(sourceCodeKind.Value)
                : new[] { SourceCodeKind.Regular, SourceCodeKind.Script };

            foreach (var kind in kinds)
            {
                using (var workspace = await TestWorkspaceFactory.CreateWorkspaceFromLinesAsync(
                           LanguageName,
                           compilationOptions: null,
                           parseOptions: DefaultParseOptions.WithKind(kind),
                           content: code))
                {
                    var hostDocument = workspace.DocumentWithCursor;
                    var document     = workspace.CurrentSolution.GetDocument(hostDocument.Id);
                    Assert.Empty((await document.GetSyntaxTreeAsync()).GetDiagnostics());
                    var targetPosition = await GoToAdjacentMemberCommandHandler.GetTargetPositionAsync(
                        document,
                        hostDocument.CursorPosition.Value,
                        next,
                        CancellationToken.None);

                    Assert.NotNull(targetPosition);
                    Assert.Equal(hostDocument.SelectedSpans.Single().Start, targetPosition.Value);
                }
            }
        }
 private static async Task <int?> GetTargetPositionAsync(string code, bool next)
 {
     using (var workspace = await TestWorkspaceFactory.CreateWorkspaceFromLinesAsync(
                LanguageNames.CSharp,
                new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary),
                CSharpParseOptions.Default,
                code))
     {
         var hostDocument = workspace.DocumentWithCursor;
         var document     = workspace.CurrentSolution.GetDocument(hostDocument.Id);
         Assert.Empty((await document.GetSyntaxTreeAsync()).GetDiagnostics());
         return(await GoToAdjacentMemberCommandHandler.GetTargetPositionAsync(
                    document,
                    hostDocument.CursorPosition.Value,
                    next,
                    CancellationToken.None));
     }
 }
        protected async Task <int?> GetTargetPositionAsync(string code, bool next)
        {
            using (var workspace = await TestWorkspaceFactory.CreateWorkspaceFromLinesAsync(
                       LanguageName,
                       compilationOptions: null,
                       parseOptions: DefaultParseOptions,
                       content: code))
            {
                var hostDocument = workspace.DocumentWithCursor;
                var document     = workspace.CurrentSolution.GetDocument(hostDocument.Id);
                Assert.Empty((await document.GetSyntaxTreeAsync()).GetDiagnostics());

                return(await GoToAdjacentMemberCommandHandler.GetTargetPositionAsync(
                           document,
                           hostDocument.CursorPosition.Value,
                           next,
                           CancellationToken.None));
            }
        }