forked from DotNetAnalyzers/StyleCopAnalyzers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable SA1126 (PrefixCallsCorrectly)
Fixes DotNetAnalyzers#59
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1126UnitTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace StyleCop.Analyzers.Test.ReadabilityRules | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
using StyleCop.Analyzers.ReadabilityRules; | ||
using TestHelper; | ||
using Xunit; | ||
|
||
/// <summary> | ||
/// This class contains unit tests for <see cref="SA1126PrefixCallsCorrectly"/>. | ||
/// </summary> | ||
public class SA1126UnitTests : DiagnosticVerifier | ||
{ | ||
[Fact] | ||
public async Task TestEmptySourceAsync() | ||
{ | ||
var testCode = string.Empty; | ||
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false); | ||
} | ||
|
||
[Fact] | ||
public void TestDisabledByDefaultAndNotConfigurable() | ||
{ | ||
var analyzer = this.GetCSharpDiagnosticAnalyzers().Single(); | ||
Assert.Equal(1, analyzer.SupportedDiagnostics.Length); | ||
Assert.False(analyzer.SupportedDiagnostics[0].IsEnabledByDefault); | ||
Assert.Contains(WellKnownDiagnosticTags.NotConfigurable, analyzer.SupportedDiagnostics[0].CustomTags); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers() | ||
{ | ||
yield return new SA1126PrefixCallsCorrectly(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters