private CSharpCompilation Enrich(CSharpCompilation compilation, IResourceFileEnricher enricher)
        {
            foreach (SyntaxTree syntaxTree in compilation.SyntaxTrees)
            {
                var newSyntaxTree = syntaxTree;

                CompilationUnitSyntax compilationUnit = syntaxTree.GetCompilationUnitRoot();
                string?resourceName = compilationUnit.GetResourceNameAnnotation();

                if (resourceName != null && enricher.ShouldEnrich(resourceName))
                {
                    var context = new ResourceFileEnrichmentContext(compilation, syntaxTree, resourceName);

                    CompilationUnitSyntax newCompilationUnit = enricher.Enrich(compilationUnit, context);
                    if (newCompilationUnit != compilationUnit)
                    {
                        newSyntaxTree = syntaxTree.WithRootAndOptions(newCompilationUnit, syntaxTree.Options);
                    }
                }

                if (newSyntaxTree != syntaxTree)
                {
                    compilation = compilation.ReplaceSyntaxTree(syntaxTree, newSyntaxTree);
                }
            }

            return(compilation);
        }
        public CompilationUnitSyntax Enrich(CompilationUnitSyntax target, ResourceFileEnrichmentContext context)
        {
            ClassDeclarationSyntax?classDeclaration = target.DescendantNodes()
                                                      .OfType <ClassDeclarationSyntax>()
                                                      .FirstOrDefault(p => p.Identifier.ValueText == "Authenticators");

            if (classDeclaration == null)
            {
                return(target);
            }

            return(target.ReplaceNode(
                       classDeclaration,
                       classDeclaration.AddMembers(
                           GenerateProperties().ToArray <MemberDeclarationSyntax>())));
        }