@@ -21,7 +21,7 @@ public class DictionaryTests
21
21
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeTrue({0}).And.ToString();" ,
22
22
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ToString();" ) ]
23
23
[ Implemented ]
24
- public void DictionaryShouldContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
24
+ public void DictionaryShouldContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix ( oldAssertion , newAssertion ) ;
25
25
26
26
[ DataTestMethod ]
27
27
[ AssertionDiagnostic ( "actual.ContainsKey(expectedKey).Should().BeFalse({0});" ) ]
@@ -37,7 +37,7 @@ public class DictionaryTests
37
37
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeFalse({0}).And.ToString();" ,
38
38
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().NotContainKey(expectedKey{0}).And.ToString();" ) ]
39
39
[ Implemented ]
40
- public void DictionaryShouldNotContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
40
+ public void DictionaryShouldNotContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix ( oldAssertion , newAssertion ) ;
41
41
42
42
[ DataTestMethod ]
43
43
[ AssertionDiagnostic ( "actual.ContainsValue(expectedValue).Should().BeTrue({0});" ) ]
@@ -53,7 +53,7 @@ public class DictionaryTests
53
53
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeTrue({0}).And.ToString();" ,
54
54
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ToString();" ) ]
55
55
[ Implemented ]
56
- public void DictionaryShouldContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
56
+ public void DictionaryShouldContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix ( oldAssertion , newAssertion ) ;
57
57
58
58
[ DataTestMethod ]
59
59
[ AssertionDiagnostic ( "actual.ContainsValue(expectedValue).Should().BeFalse({0});" ) ]
@@ -69,7 +69,7 @@ public class DictionaryTests
69
69
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeFalse({0}).And.ToString();" ,
70
70
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().NotContainValue(expectedValue{0}).And.ToString();" ) ]
71
71
[ Implemented ]
72
- public void DictionaryShouldNotContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
72
+ public void DictionaryShouldNotContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix ( oldAssertion , newAssertion ) ;
73
73
74
74
[ DataTestMethod ]
75
75
[ AssertionDiagnostic ( "actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue);" ) ]
@@ -113,7 +113,7 @@ public class DictionaryTests
113
113
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ContainKey(expectedKey).And.ToString();" ,
114
114
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
115
115
[ Implemented ]
116
- public void DictionaryShouldContainKeyAndValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
116
+ public void DictionaryShouldContainKeyAndValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix ( oldAssertion , newAssertion ) ;
117
117
118
118
[ DataTestMethod ]
119
119
[ AssertionDiagnostic ( "actual.Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value);" ) ]
@@ -157,7 +157,7 @@ public class DictionaryTests
157
157
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(pair.Value).And.ContainKey(pair.Key{0}).And.ToString();" ,
158
158
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(pair{0}).And.ToString();" ) ]
159
159
[ Implemented ]
160
- public void DictionaryShouldContainPair_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
160
+ public void DictionaryShouldContainPair_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix ( oldAssertion , newAssertion ) ;
161
161
162
162
private void VerifyCSharpDiagnostic ( string sourceAssersion , DiagnosticMetadata metadata )
163
163
{
@@ -176,14 +176,18 @@ private void VerifyCSharpDiagnostic(string sourceAssersion, DiagnosticMetadata m
176
176
} ) ;
177
177
}
178
178
179
- private void VerifyCSharpFix < TCodeFixProvider , TDiagnosticAnalyzer > ( string oldSourceAssertion , string newSourceAssertion )
180
- where TCodeFixProvider : Microsoft . CodeAnalysis . CodeFixes . CodeFixProvider , new ( )
181
- where TDiagnosticAnalyzer : Microsoft . CodeAnalysis . Diagnostics . DiagnosticAnalyzer , new ( )
179
+ private void VerifyCSharpFix ( string oldSourceAssertion , string newSourceAssertion )
182
180
{
183
181
var oldSource = GenerateCode . GenericIDictionaryAssertion ( oldSourceAssertion ) ;
184
182
var newSource = GenerateCode . GenericIDictionaryAssertion ( newSourceAssertion ) ;
185
183
186
- DiagnosticVerifier . VerifyCSharpFix < TCodeFixProvider , TDiagnosticAnalyzer > ( oldSource , newSource ) ;
184
+ DiagnosticVerifier . VerifyFix ( new CodeFixVerifierArguments ( )
185
+ . WithSources ( oldSource )
186
+ . WithFixedSources ( newSource )
187
+ . WithDiagnosticAnalyzer < FluentAssertionsOperationAnalyzer > ( )
188
+ . WithCodeFixProvider < FluentAssertionsCodeFixProvider > ( )
189
+ . WithPackageReferences ( PackageReference . FluentAssertions_6_12_0 )
190
+ ) ;
187
191
}
188
192
}
189
193
}
0 commit comments