@@ -21,7 +21,7 @@ public class DictionaryTests
2121 oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeTrue({0}).And.ToString();" ,
2222 newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ToString();" ) ]
2323 [ 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 ) ;
2525
2626 [ DataTestMethod ]
2727 [ AssertionDiagnostic ( "actual.ContainsKey(expectedKey).Should().BeFalse({0});" ) ]
@@ -37,7 +37,7 @@ public class DictionaryTests
3737 oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeFalse({0}).And.ToString();" ,
3838 newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().NotContainKey(expectedKey{0}).And.ToString();" ) ]
3939 [ 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 ) ;
4141
4242 [ DataTestMethod ]
4343 [ AssertionDiagnostic ( "actual.ContainsValue(expectedValue).Should().BeTrue({0});" ) ]
@@ -53,7 +53,7 @@ public class DictionaryTests
5353 oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeTrue({0}).And.ToString();" ,
5454 newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ToString();" ) ]
5555 [ 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 ) ;
5757
5858 [ DataTestMethod ]
5959 [ AssertionDiagnostic ( "actual.ContainsValue(expectedValue).Should().BeFalse({0});" ) ]
@@ -69,7 +69,7 @@ public class DictionaryTests
6969 oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeFalse({0}).And.ToString();" ,
7070 newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().NotContainValue(expectedValue{0}).And.ToString();" ) ]
7171 [ 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 ) ;
7373
7474 [ DataTestMethod ]
7575 [ AssertionDiagnostic ( "actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue);" ) ]
@@ -113,7 +113,7 @@ public class DictionaryTests
113113 oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ContainKey(expectedKey).And.ToString();" ,
114114 newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
115115 [ 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 ) ;
117117
118118 [ DataTestMethod ]
119119 [ AssertionDiagnostic ( "actual.Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value);" ) ]
@@ -157,7 +157,7 @@ public class DictionaryTests
157157 oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(pair.Value).And.ContainKey(pair.Key{0}).And.ToString();" ,
158158 newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(pair{0}).And.ToString();" ) ]
159159 [ 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 ) ;
161161
162162 private void VerifyCSharpDiagnostic ( string sourceAssersion , DiagnosticMetadata metadata )
163163 {
@@ -176,14 +176,18 @@ private void VerifyCSharpDiagnostic(string sourceAssersion, DiagnosticMetadata m
176176 } ) ;
177177 }
178178
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 )
182180 {
183181 var oldSource = GenerateCode . GenericIDictionaryAssertion ( oldSourceAssertion ) ;
184182 var newSource = GenerateCode . GenericIDictionaryAssertion ( newSourceAssertion ) ;
185183
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+ ) ;
187191 }
188192 }
189193}
0 commit comments