@@ -71,9 +71,15 @@ public class DictionaryTests
71
71
public void DictionaryShouldNotContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldNotContainValueCodeFix , DictionaryShouldNotContainValueAnalyzer > ( oldAssertion , newAssertion ) ;
72
72
73
73
[ AssertionDataTestMethod ]
74
- [ AssertionDiagnostic ( "actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue{0});" ) ]
75
- [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue{0}).And.ToString();" ) ]
76
- [ NotImplemented ]
74
+ [ AssertionDiagnostic ( "actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue);" ) ]
75
+ [ AssertionDiagnostic ( "actual.Should().ContainKey(expectedKey).And.ContainValue(expectedValue{0});" ) ]
76
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue).And.ToString();" ) ]
77
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey).And.ContainValue(expectedValue{0}).And.ToString();" ) ]
78
+ [ AssertionDiagnostic ( "actual.Should().ContainValue(expectedValue{0}).And.ContainKey(expectedKey);" ) ]
79
+ [ AssertionDiagnostic ( "actual.Should().ContainValue(expectedValue).And.ContainKey(expectedKey{0});" ) ]
80
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ContainKey(expectedKey).And.ToString();" ) ]
81
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue).And.ContainKey(expectedKey{0}).And.ToString();" ) ]
82
+ [ Implemented ]
77
83
public void DictionaryShouldContainKeyAndValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainKeyAndValueAnalyzer > ( assertion ) ;
78
84
79
85
[ AssertionDataTestMethod ]
@@ -89,29 +95,59 @@ public class DictionaryTests
89
95
[ AssertionCodeFix (
90
96
oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey).And.ContainValue(expectedValue{0}).And.ToString();" ,
91
97
newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
92
- [ NotImplemented ]
98
+ [ AssertionCodeFix (
99
+ oldAssertion : "actual.Should().ContainValue(expectedValue{0}).And.ContainKey(expectedKey);" ,
100
+ newAssertion : "actual.Should().Contain(expectedKey, expectedValue{0});" ) ]
101
+ [ AssertionCodeFix (
102
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue).And.ContainKey(expectedKey{0}).And.ToString();" ,
103
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
104
+ [ AssertionCodeFix (
105
+ oldAssertion : "actual.Should().ContainValue(expectedValue).And.ContainKey(expectedKey{0});" ,
106
+ newAssertion : "actual.Should().Contain(expectedKey, expectedValue{0});" ) ]
107
+ [ AssertionCodeFix (
108
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ContainKey(expectedKey).And.ToString();" ,
109
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
110
+ [ Implemented ]
93
111
public void DictionaryShouldContainKeyAndValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainKeyAndValueCodeFix , DictionaryShouldContainKeyAndValueAnalyzer > ( oldAssertion , newAssertion ) ;
94
112
95
113
[ AssertionDataTestMethod ]
96
- [ AssertionDiagnostic ( "actual.Should().ContainKey(expected.Key{0}).And.ContainValue(expected.Value);" ) ]
97
- [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expected.Key{0}).And.ContainValue(expected.Value).And.ToString();" ) ]
98
- [ NotImplemented ]
114
+ [ AssertionDiagnostic ( "actual.Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value);" ) ]
115
+ [ AssertionDiagnostic ( "actual.Should().ContainKey(pair.Key).And.ContainValue(pair.Value{0});" ) ]
116
+ [ AssertionDiagnostic ( "actual.Should().ContainValue(pair.Value{0}).And.ContainKey(pair.Key);" ) ]
117
+ [ AssertionDiagnostic ( "actual.Should().ContainValue(pair.Value).And.ContainKey(pair.Key{0});" ) ]
118
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value).And.ToString();" ) ]
119
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(pair.Key).And.ContainValue(pair.Value{0}).And.ToString();" ) ]
120
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(pair.Value{0}).And.ContainKey(pair.Key).And.ToString();" ) ]
121
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(pair.Value).And.ContainKey(pair.Key{0}).And.ToString();" ) ]
122
+ [ Implemented ]
99
123
public void DictionaryShouldContainPair_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainPairAnalyzer > ( assertion ) ;
100
124
101
125
[ AssertionDataTestMethod ]
102
126
[ AssertionCodeFix (
103
- oldAssertion : "actual.Should().ContainKey(expected.Key{0}).And.ContainValue(expected.Value);" ,
104
- newAssertion : "actual.Should().Contain(expected{0});" ) ]
127
+ oldAssertion : "actual.Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value);" ,
128
+ newAssertion : "actual.Should().Contain(pair{0});" ) ]
129
+ [ AssertionCodeFix (
130
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value).And.ToString();" ,
131
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(pair{0}).And.ToString();" ) ]
105
132
[ AssertionCodeFix (
106
- oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value). Should().ContainKey(expected .Key{0} ).And.ContainValue(expected .Value).And.ToString( );" ,
107
- newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value). Should().Contain(expected {0}).And.ToString( );" ) ]
133
+ oldAssertion : "actual.Should().ContainKey(pair .Key).And.ContainValue(pair .Value{0} );" ,
134
+ newAssertion : "actual.Should().Contain(pair {0});" ) ]
108
135
[ AssertionCodeFix (
109
- oldAssertion : "actual.Should().ContainKey(expected .Key).And.ContainValue(expected .Value{0});" ,
110
- newAssertion : "actual.Should().Contain(expected {0});" ) ]
136
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value). Should().ContainKey(pair .Key).And.ContainValue(pair .Value{0}).And.ToString( );" ,
137
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value). Should().Contain(pair {0}).And.ToString( );" ) ]
111
138
[ AssertionCodeFix (
112
- oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expected.Key).And.ContainValue(expected.Value{0}).And.ToString();" ,
113
- newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expected{0}).And.ToString();" ) ]
114
- [ NotImplemented ]
139
+ oldAssertion : "actual.Should().ContainValue(pair.Value{0}).And.ContainKey(pair.Key);" ,
140
+ newAssertion : "actual.Should().Contain(pair{0});" ) ]
141
+ [ AssertionCodeFix (
142
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(pair.Value{0}).And.ContainKey(pair.Key).And.ToString();" ,
143
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(pair{0}).And.ToString();" ) ]
144
+ [ AssertionCodeFix (
145
+ oldAssertion : "actual.Should().ContainValue(pair.Value).And.ContainKey(pair.Key{0});" ,
146
+ newAssertion : "actual.Should().Contain(pair{0});" ) ]
147
+ [ AssertionCodeFix (
148
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(pair.Value).And.ContainKey(pair.Key{0}).And.ToString();" ,
149
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(pair{0}).And.ToString();" ) ]
150
+ [ Implemented ]
115
151
public void DictionaryShouldContainPair_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainPairCodeFix , DictionaryShouldContainPairAnalyzer > ( oldAssertion , newAssertion ) ;
116
152
117
153
private void VerifyCSharpDiagnostic < TDiagnosticAnalyzer > ( string sourceAssersion ) where TDiagnosticAnalyzer : Microsoft . CodeAnalysis . Diagnostics . DiagnosticAnalyzer , new ( )
0 commit comments