public static void SingleDocumentOneErrorCorrectFixExplicitTitleExpectedDiagnosticWithPositionAnalyzerSupportsTwoDiagnostics2() { var before = @" namespace N { class C { private readonly int ↓_value; } }"; var after = @" namespace N { class C { private readonly int value; } }"; var expectedDiagnostic = ExpectedDiagnostic.Create(FieldNameMustNotBeginWithUnderscoreDifferentDiagnosticsForPublic.Id2); var analyzer = new FieldNameMustNotBeginWithUnderscoreDifferentDiagnosticsForPublic(); var fix = new DoNotUseUnderscoreFix(); RoslynAssert.FixAll(analyzer, fix, expectedDiagnostic, before, after); RoslynAssert.FixAll(analyzer, fix, expectedDiagnostic, new[] { before }, after); RoslynAssert.FixAll(analyzer, fix, expectedDiagnostic, before, after, fixTitle: "Rename to: 'value'"); RoslynAssert.FixAll(analyzer, fix, expectedDiagnostic, new[] { before }, after, fixTitle: "Rename to: 'value'"); }
public static void OneErrorWithExpectedDiagnosticWithMessageWhenAnalyzerSupportsTwoDiagnostics() { var code = @" namespace N { class C { private readonly int ↓_value1; } }"; var expectedDiagnostic = ExpectedDiagnostic.CreateFromCodeWithErrorsIndicated("SA1309b", "Field '_value1' must not begin with an underscore", code, out code); var analyzer = new FieldNameMustNotBeginWithUnderscoreDifferentDiagnosticsForPublic(); RoslynAssert.Diagnostics(analyzer, expectedDiagnostic, code); RoslynAssert.Diagnostics(analyzer, new[] { expectedDiagnostic }, code); }