public async Task VerifyGetFixesWhenClassIsSealed()
    {
      var code = File.ReadAllText(
        $@"Targets\{nameof(IsOperationMethodPublicMakeNonPublicCodeFixTests)}\{(nameof(this.VerifyGetFixesWhenClassIsSealed))}.cs");
      var document = TestHelpers.Create(code);
      var tree = await document.GetSyntaxTreeAsync();
      var diagnostics = await TestHelpers.GetDiagnosticsAsync(code, new IsOperationMethodPublicAnalyzer());
      var sourceSpan = diagnostics[0].Location.SourceSpan;

      var actions = new List<CodeAction>();
      var codeActionRegistration = new Action<CodeAction, ImmutableArray<Diagnostic>>(
        (a, _) => { actions.Add(a); });

      var fix = new IsOperationMethodPublicMakeNonPublicCodeFix();
      var codeFixContext = new CodeFixContext(document, diagnostics[0],
        codeActionRegistration, new CancellationToken(false));
      await fix.RegisterCodeFixesAsync(codeFixContext);

      Assert.AreEqual(2, actions.Count);
      await TestHelpers.VerifyActionAsync(actions,
        IsOperationMethodPublicAnalyzerMakeNonPublicCodeFixConstants.PrivateDescription, document,
        tree, new[] { "rivate" });
      await TestHelpers.VerifyActionAsync(actions,
        IsOperationMethodPublicAnalyzerMakeNonPublicCodeFixConstants.InternalDescription, document,
        tree, new[] { "internal" });
    }
        public override async Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);

            if (context.CancellationToken.IsCancellationRequested)
            {
                return;
            }

            var diagnostic = context.Diagnostics.First();
            var methodNode = root.FindNode(diagnostic.Location.SourceSpan) as MethodDeclarationSyntax;

            if (context.CancellationToken.IsCancellationRequested)
            {
                return;
            }

            IsOperationMethodPublicMakeNonPublicCodeFix.RegisterNewCodeFix(
                context, root, methodNode, SyntaxKind.PrivateKeyword,
                IsOperationMethodPublicAnalyzerMakeNonPublicCodeFixConstants.PrivateDescription, diagnostic);
            IsOperationMethodPublicMakeNonPublicCodeFix.RegisterNewCodeFix(
                context, root, methodNode, SyntaxKind.InternalKeyword,
                IsOperationMethodPublicAnalyzerMakeNonPublicCodeFixConstants.InternalDescription, diagnostic);

            var isSealed = bool.Parse(diagnostic.Properties[IsOperationMethodPublicAnalyzerConstants.IsSealed]);

            if (!isSealed)
            {
                IsOperationMethodPublicMakeNonPublicCodeFix.RegisterNewCodeFix(
                    context, root, methodNode, SyntaxKind.ProtectedKeyword,
                    IsOperationMethodPublicAnalyzerMakeNonPublicCodeFixConstants.ProtectedDescription, diagnostic);
            }
        }
    public void VerifyGetFixableDiagnosticIds()
    {
      var fix = new IsOperationMethodPublicMakeNonPublicCodeFix();
      var ids = fix.FixableDiagnosticIds.ToList();

      Assert.AreEqual(1, ids.Count, nameof(ids.Count));
      Assert.AreEqual(IsOperationMethodPublicAnalyzerConstants.DiagnosticId, ids[0],
        nameof(IsOperationMethodPublicAnalyzerConstants.DiagnosticId));
    }