-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
248e785
commit 3f1a366
Showing
8 changed files
with
161 additions
and
31 deletions.
There are no files selected for viewing
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
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
60 changes: 60 additions & 0 deletions
60
src/Tests/Analyzers.Tests/RCS1060DeclareEachTypeInSeparateFileTests.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,60 @@ | ||
// Copyright (c) .NET Foundation and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis; | ||
using Roslynator.CSharp.CodeFixes; | ||
using Roslynator.Testing.CSharp; | ||
using Xunit; | ||
|
||
namespace Roslynator.CSharp.Analysis.Tests; | ||
|
||
public class RCS1060DeclareEachTypeInSeparateFileTests : AbstractCSharpDiagnosticVerifier<DeclareEachTypeInSeparateFileAnalyzer, ExtractMemberToNewDocumentCodeFixProvider> | ||
{ | ||
public override DiagnosticDescriptor Descriptor => DiagnosticRules.DeclareEachTypeInSeparateFile; | ||
|
||
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.DeclareEachTypeInSeparateFile)] | ||
public async Task Test_Namespace() | ||
{ | ||
await VerifyDiagnosticAndFixAsync(""" | ||
namespace N | ||
{ | ||
public class [|C1|] | ||
{ | ||
} | ||
public class [|C2|] | ||
{ | ||
} | ||
} | ||
""", """ | ||
namespace N | ||
{ | ||
public class C2 | ||
{ | ||
} | ||
} | ||
"""); | ||
} | ||
|
||
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.DeclareEachTypeInSeparateFile)] | ||
public async Task Test_FileScopedNamespace() | ||
{ | ||
await VerifyDiagnosticAndFixAsync(""" | ||
namespace N; | ||
public class [|C1|] | ||
{ | ||
} | ||
public class [|C2|] | ||
{ | ||
} | ||
""", """ | ||
namespace N; | ||
public class C2 | ||
{ | ||
} | ||
"""); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/Tests/Refactorings.Tests/RR0046ExtractTypeDeclarationToNewFileTests.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,62 @@ | ||
// Copyright (c) .NET Foundation and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
using Roslynator.Testing.CSharp; | ||
using Xunit; | ||
|
||
namespace Roslynator.CSharp.Refactorings.Tests; | ||
|
||
public class RR0046ExtractTypeDeclarationToNewFileTests : AbstractCSharpRefactoringVerifier | ||
{ | ||
public override string RefactoringId { get; } = RefactoringIdentifiers.ExtractTypeDeclarationToNewFile; | ||
|
||
[Fact, Trait(Traits.Refactoring, RefactoringIdentifiers.ExtractTypeDeclarationToNewFile)] | ||
public async Task Test_Namespace() | ||
{ | ||
await VerifyRefactoringAsync(""" | ||
namespace N | ||
{ | ||
public class C1 | ||
{ | ||
} | ||
public class [||]C2 | ||
{ | ||
} | ||
} | ||
""", """ | ||
namespace N | ||
{ | ||
public class C1 | ||
{ | ||
} | ||
} | ||
""", equivalenceKey: EquivalenceKey.Create(RefactoringId)); | ||
} | ||
|
||
[Fact, Trait(Traits.Refactoring, RefactoringIdentifiers.ExtractTypeDeclarationToNewFile)] | ||
public async Task Test_FileScopedNamespace() | ||
{ | ||
await VerifyRefactoringAsync(""" | ||
namespace N; | ||
public class C1 | ||
{ | ||
} | ||
public class [||]C2 | ||
{ | ||
} | ||
""", """ | ||
namespace N; | ||
public class C1 | ||
{ | ||
} | ||
""", equivalenceKey: EquivalenceKey.Create(RefactoringId)); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
is_global = true | ||
|
||
roslnator.max_line_length = 140 | ||
roslynator.prefix_field_identifier_with_underscore = false | ||
|
||
roslynator.refactoring.RR0010.enabled = false | ||
roslynator.refactoring.RR0012.enabled = false | ||
roslynator.refactoring.RR0066.enabled = false | ||
roslynator.refactoring.RR0088.enabled = false | ||
roslynator.refactoring.RR0138.enabled = false | ||
roslynator.refactoring.RR0171.enabled = false | ||
roslynator.refactoring.RR0188.enabled = false | ||
roslynator_refactoring.convert_foreach_to_for_and_reverse_loop.enabled = false | ||
roslynator_refactoring.expand_initializer.enabled = false | ||
roslynator_refactoring.extract_type_declaration_to_new_file.enabled = false | ||
roslynator_refactoring.introduce_constructor.enabled = false | ||
roslynator_refactoring.remove_all_documentation_comments.enabled = false | ||
roslynator_refactoring.replace_method_with_property.enabled = false | ||
roslynator_refactoring.use_string_empty_instead_of_empty_string_literal.enabled = false |
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