public static async Task Null_syntax_root_argument_exception()
        {
            var ex = await Should.ThrowAsync <ArgumentNullException>(
                () => FunctionBreakpointUtils.GetFunctionBreakpointNameFactoryAsync(string.Empty, syntaxRoot: null, new TextSpan(0, 0), c => null, default));

            ex.ParamName.ShouldBe("syntaxRoot");
        }
        public static async Task Null_semantic_model_accessor_argument_exception()
        {
            var ex = await Should.ThrowAsync <ArgumentNullException>(
                () => FunctionBreakpointUtils.GetFunctionBreakpointNameFactoryAsync(string.Empty, SyntaxFactory.IdentifierName(""), new TextSpan(0, 0), semanticModelAccessor: null, default));

            ex.ParamName.ShouldBe("semanticModelAccessor");
        }
        private static async Task <string> GetFunctionBreakpointNameAsync(string annotatedSource, bool permitCompilationErrors = false)
        {
            var(source, span) = AnnotatedSourceUtils.Parse(annotatedSource, nameof(annotatedSource));

            var syntaxTree = CSharpSyntaxTree.ParseText(source);

            var compilation = new Lazy <CSharpCompilation>(() =>
                                                           CSharpCompilation.Create(
                                                               nameof(GetFunctionBreakpointNameAsync),
                                                               new[] { syntaxTree },
                                                               new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) },
                                                               new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)));

            if (!permitCompilationErrors)
            {
                Assert.That(compilation.Value.GetDiagnostics().Where(d => d.Severity == DiagnosticSeverity.Error), Is.Empty);
            }

            var factory = await FunctionBreakpointUtils.GetFunctionBreakpointNameFactoryAsync(
                await syntaxTree.GetRootAsync().ConfigureAwait(false),
                span,
                c => Task.FromResult(compilation.Value.GetSemanticModel(syntaxTree, ignoreAccessibility: false)),
                CancellationToken.None).ConfigureAwait(false);

            return(factory?.ToString());
        }