Skip to content

Commit 158f723

Browse files
authored
Refactoring remove old testframework (#13)
* wip dirty * intermediate state * wip * refactoring done
1 parent e567a4f commit 158f723

22 files changed

+1479
-2641
lines changed

Amusoft.CodeAnalysis.Analyzers.sln.DotSettings

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,39 @@
22
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright $CREATED_YEAR$ Andreas Müller&#xD;
33
This file is a part of Amusoft.CodeAnalysis.Analyzers and is licensed under Apache 2.0&#xD;
44
See https://github.com/taori/Amusoft.CodeAnalysis.Analyzers/blob/master/LICENSE for details</s:String>
5+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/@KeyIndexDefined">True</s:Boolean>
6+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
7+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Field/=codeFix/@KeyIndexDefined">True</s:Boolean>
8+
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Field/=codeFix/Order/@EntryValue">0</s:Int64>
9+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Reformat/@EntryValue">True</s:Boolean>
10+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean>
11+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
12+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String>
13+
14+
15+
16+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Shortcut/@EntryValue">testCodeFix</s:String>
17+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/ShortenQualifiedReferences/@EntryValue">True</s:Boolean>
18+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=059C687F40E9A548ADF8B7D42F0A6BF8/Text/@EntryValue">await new Amusoft.CodeAnalysis.Analyzers.Test.Helpers.CodeFixTest&lt;EmptyDiagnosticAnalyzer, $codeFix$&gt;()&#xD;
19+
{&#xD;
20+
TestBehaviors = TestBehaviors.SkipGeneratedCodeCheck,&#xD;
21+
CompilerDiagnostics = CompilerDiagnostics.Errors | CompilerDiagnostics.Warnings,&#xD;
22+
TestState =&#xD;
23+
{&#xD;
24+
Sources = { test },&#xD;
25+
ExpectedDiagnostics =&#xD;
26+
{&#xD;
27+
$END$&#xD;
28+
},&#xD;
29+
},&#xD;
30+
FixedState =&#xD;
31+
{&#xD;
32+
ExpectedDiagnostics =&#xD;
33+
{&#xD;
34+
},&#xD;
35+
Sources = { fixtest }&#xD;
36+
},&#xD;
37+
}.RunAsync();</s:String>
538
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=21CCC48EE521CF46B74D3A0C28EEFF1E/@KeyIndexDefined">True</s:Boolean>
639
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=21CCC48EE521CF46B74D3A0C28EEFF1E/Description/@EntryValue">&amp;CodeFixTest</s:String>
740
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=21CCC48EE521CF46B74D3A0C28EEFF1E/Field/=CLASS/Expression/@EntryValue">getAlphaNumericFileNameWithoutExtension()</s:String>
@@ -106,6 +139,20 @@ namespace ConsoleApplication1&#xD;
106139
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=21CCC48EE521CF46B74D3A0C28EEFF1E/Field/=NAMESPACE/Order/@EntryValue">1</s:Int64>
107140
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=21CCC48EE521CF46B74D3A0C28EEFF1E/Field/=CLASS/@KeyIndexDefined">True</s:Boolean>
108141
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=21CCC48EE521CF46B74D3A0C28EEFF1E/Field/=CLASS/Order/@EntryValue">2</s:Int64>
142+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/@KeyIndexDefined">True</s:Boolean>
143+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
144+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Reformat/@EntryValue">True</s:Boolean>
145+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Scope/=E6E678D4B937A84D8C4585DDD2F27DB0/@KeyIndexDefined">True</s:Boolean>
146+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Scope/=E6E678D4B937A84D8C4585DDD2F27DB0/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
147+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Scope/=E6E678D4B937A84D8C4585DDD2F27DB0/Type/@EntryValue">InCSharpExpression</s:String>
148+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Shortcut/@EntryValue">testSimpleCodeFix</s:String>
149+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/ShortenQualifiedReferences/@EntryValue">True</s:Boolean>
150+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=44E679DCDD48FA49A9713D37E6668B2D/Text/@EntryValue">var expected = new DiagnosticResult[]&#xD;
151+
{&#xD;
152+
$END$&#xD;
153+
};&#xD;
154+
&#xD;
155+
await Verifier.VerifyCodeFixAsync(test, expected, fixtest);</s:String>
109156
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=EF22B9F0D1F98943AB7B20E28E6E8504/@KeyIndexDefined">True</s:Boolean>
110157
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=EF22B9F0D1F98943AB7B20E28E6E8504/Applicability/=File/@EntryIndexedValue">True</s:Boolean>
111158
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=EF22B9F0D1F98943AB7B20E28E6E8504/CustomProperties/=Extension/@EntryIndexedValue">cs</s:String>
@@ -173,4 +220,30 @@ namespace $NAMESPACE$&#xD;
173220
return rootNode;&#xD;
174221
}&#xD;
175222
}&#xD;
176-
}</s:String></wpf:ResourceDictionary>
223+
}</s:String>
224+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/@KeyIndexDefined">True</s:Boolean>
225+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
226+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Field/=analyzer/@KeyIndexDefined">True</s:Boolean>
227+
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Field/=analyzer/Order/@EntryValue">0</s:Int64>
228+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Reformat/@EntryValue">True</s:Boolean>
229+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean>
230+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
231+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String>
232+
233+
234+
235+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Shortcut/@EntryValue">testAnalyzer</s:String>
236+
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/ShortenQualifiedReferences/@EntryValue">True</s:Boolean>
237+
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=FBFED94699A2CE49BB04B55CA7B6FBFF/Text/@EntryValue">await new Amusoft.CodeAnalysis.Analyzers.Test.Helpers.AnalyzerTest&lt;$analyzer$&gt;()&#xD;
238+
{&#xD;
239+
TestBehaviors = TestBehaviors.SkipGeneratedCodeCheck,&#xD;
240+
CompilerDiagnostics = CompilerDiagnostics.Warnings | CompilerDiagnostics.Suggestions,&#xD;
241+
TestState =&#xD;
242+
{&#xD;
243+
Sources = {test},&#xD;
244+
ExpectedDiagnostics =&#xD;
245+
{&#xD;
246+
$END$&#xD;
247+
},&#xD;
248+
}&#xD;
249+
}.RunAsync();</s:String></wpf:ResourceDictionary>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- CS0407
1616
- CS0123
17+
- CS1998
1718

1819
## References
1920
- [Repository docs](https://github.com/taori/Amusoft.CodeAnalysis.Analyzers/tree/master/docs)

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
maximumCpuCount: true
5959

6060
- task: DotNetCoreCLI@2
61+
displayName: dotnet test *.csproj
6162
inputs:
6263
command: 'test'
6364
projects: '**/*test*/*.csproj'

src/Amusoft.CodeAnalysis.Analyzers.Test/Amusoft.CodeAnalysis.Analyzers.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" Version="1.0.1-beta1.20062.1" />
9-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.MSTest" Version="1.0.1-beta1.20062.1" />
8+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" Version="1.0.1-beta1.20067.1" />
9+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.MSTest" Version="1.0.1-beta1.20067.1" />
1010
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.4.0" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
1212
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />

src/Amusoft.CodeAnalysis.Analyzers.Test/Helpers/CodeFixTest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ public class CodeFixTest<TAnalyzer, TCodeFix> : CSharpCodeFixTest<TAnalyzer, TCo
1414
where TCodeFix : CodeFixProvider, new()
1515
{
1616
}
17+
18+
public class AnalyzerTest<TAnalyzer> : CSharpAnalyzerTest<TAnalyzer, MSTestVerifier>
19+
where TAnalyzer : DiagnosticAnalyzer, new()
20+
{
21+
}
1722
}

src/Amusoft.CodeAnalysis.Analyzers.Test/Helpers/CodeFixVerifier.Helper.cs

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/Amusoft.CodeAnalysis.Analyzers.Test/Helpers/DiagnosticResult.cs

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)