-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSA1402ForClassCSharp10UnitTests.cs
More file actions
45 lines (39 loc) · 1.41 KB
/
SA1402ForClassCSharp10UnitTests.cs
File metadata and controls
45 lines (39 loc) · 1.41 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
42
43
44
45
// 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.CSharp10.MaintainabilityRules
{
using System.Threading;
using System.Threading.Tasks;
using StyleCop.Analyzers.Test.CSharp9.MaintainabilityRules;
using Xunit;
public partial class SA1402ForClassCSharp10UnitTests : SA1402ForClassCSharp9UnitTests
{
[Fact]
[WorkItem(3435, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3435")]
public async Task VerifyTwoClassesWithFileScopedNamespacesAsync()
{
var testCode = $@"namespace TestNamespace;
public class TestClass1 {{ }}
public class {{|#0:TestClass2|}} {{ }}
";
var fixedCode1 = $@"namespace TestNamespace;
public class TestClass1 {{ }}
";
var fixedCode2 = $@"namespace TestNamespace;
public class TestClass2 {{ }}
";
var expectedDiagnostic = this.Diagnostic().WithLocation(0);
await this.VerifyCSharpFixAsync(
testCode,
this.GetSettings(),
expectedDiagnostic,
new[]
{
("/0/Test0.cs", fixedCode1),
("TestClass2.cs", fixedCode2),
},
CancellationToken.None).ConfigureAwait(true);
}
}
}