-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSA1403UnitTests.cs
More file actions
41 lines (32 loc) · 1.24 KB
/
Copy pathSA1403UnitTests.cs
File metadata and controls
41 lines (32 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) Contributors to the New StyleCop Analyzers project.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#nullable disable
namespace StyleCop.Analyzers.Test.MaintainabilityRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.MaintainabilityRules;
using Xunit;
public class SA1403UnitTests : FileMayOnlyContainTestBase
{
public override string Keyword => "namespace";
public override bool SupportsCodeFix => false;
protected override DiagnosticAnalyzer Analyzer => new SA1403FileMayOnlyContainASingleNamespace();
protected override CodeFixProvider CodeFix => new EmptyCodeFixProvider();
[Fact]
public async Task TestNestedNamespacesAsync()
{
var testCode = @"namespace Foo
{
namespace Bar
{
}
}";
DiagnosticResult expected = this.Diagnostic().WithLocation(3, 15);
await this.VerifyCSharpDiagnosticAsync(testCode, this.GetSettings(), expected, CancellationToken.None).ConfigureAwait(true);
}
}
}