@@ -6,75 +6,111 @@ namespace FluentAssertions.BestPractices.Tests
6
6
[ TestClass ]
7
7
public class DictionaryTests
8
8
{
9
- [ TestMethod ]
10
- [ AssertionDiagnostic ( "actual.ContainsKey(expected).Should().BeTrue();" ) ]
11
- [ NotImplemented ]
9
+ [ AssertionDataTestMethod ]
10
+ [ AssertionDiagnostic ( "actual.ContainsKey(expectedKey).Should().BeTrue({0});" ) ]
11
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeTrue({0}).And.ToString();" ) ]
12
+ [ Implemented ]
12
13
public void DictionaryShouldContainKey_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainKeyAnalyzer > ( assertion ) ;
13
14
14
- [ TestMethod ]
15
+ [ AssertionDataTestMethod ]
15
16
[ AssertionCodeFix (
16
- oldAssertion : "actual.ContainsKey(expected).Should().BeTrue();" ,
17
- newAssertion : "actual.Should().ContainKey(expected);" ) ]
18
- [ NotImplemented ]
17
+ oldAssertion : "actual.ContainsKey(expectedKey).Should().BeTrue({0});" ,
18
+ newAssertion : "actual.Should().ContainKey(expectedKey{0});" ) ]
19
+ [ AssertionCodeFix (
20
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeTrue({0}).And.ToString();" ,
21
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ToString();" ) ]
22
+ [ Implemented ]
19
23
public void DictionaryShouldContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainKeyCodeFix , DictionaryShouldContainKeyAnalyzer > ( oldAssertion , newAssertion ) ;
20
24
21
- [ TestMethod ]
22
- [ AssertionDiagnostic ( "actual.ContainsKey(expected).Should().BeFalse();" ) ]
23
- [ NotImplemented ]
25
+ [ AssertionDataTestMethod ]
26
+ [ AssertionDiagnostic ( "actual.ContainsKey(expectedKey).Should().BeFalse({0});" ) ]
27
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeFalse({0}).And.ToString();" ) ]
28
+ [ Implemented ]
24
29
public void DictionaryShouldNotContainKey_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldNotContainKeyAnalyzer > ( assertion ) ;
25
30
26
- [ TestMethod ]
31
+ [ AssertionDataTestMethod ]
27
32
[ AssertionCodeFix (
28
- oldAssertion : "actual.ContainsKey(expected).Should().BeFalse();" ,
29
- newAssertion : "actual.Should().NotContainKey(expected);" ) ]
30
- [ NotImplemented ]
33
+ oldAssertion : "actual.ContainsKey(expectedKey).Should().BeFalse({0});" ,
34
+ newAssertion : "actual.Should().NotContainKey(expectedKey{0});" ) ]
35
+ [ AssertionCodeFix (
36
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeFalse({0}).And.ToString();" ,
37
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().NotContainKey(expectedKey{0}).And.ToString();" ) ]
38
+ [ Implemented ]
31
39
public void DictionaryShouldNotContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldNotContainKeyCodeFix , DictionaryShouldNotContainKeyAnalyzer > ( oldAssertion , newAssertion ) ;
32
40
33
- [ TestMethod ]
34
- [ AssertionDiagnostic ( "actual.ContainsValue(expected).Should().BeTrue();" ) ]
35
- [ NotImplemented ]
41
+ [ AssertionDataTestMethod ]
42
+ [ AssertionDiagnostic ( "actual.ContainsValue(expectedValue).Should().BeTrue({0});" ) ]
43
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeTrue({0}).And.ToString();" ) ]
44
+ [ Implemented ]
36
45
public void DictionaryShouldContainValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainValueAnalyzer > ( assertion ) ;
37
46
38
- [ TestMethod ]
47
+ [ AssertionDataTestMethod ]
39
48
[ AssertionCodeFix (
40
- oldAssertion : "actual.ContainsValue(expected).Should().BeTrue();" ,
41
- newAssertion : "actual.Should().ContainValue(expected);" ) ]
42
- [ NotImplemented ]
49
+ oldAssertion : "actual.ContainsValue(expectedValue).Should().BeTrue({0});" ,
50
+ newAssertion : "actual.Should().ContainValue(expectedValue{0});" ) ]
51
+ [ AssertionCodeFix (
52
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeTrue({0}).And.ToString();" ,
53
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainValue(expectedValue{0}).And.ToString();" ) ]
54
+ [ Implemented ]
43
55
public void DictionaryShouldContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainValueCodeFix , DictionaryShouldContainValueAnalyzer > ( oldAssertion , newAssertion ) ;
44
56
45
- [ TestMethod ]
46
- [ AssertionDiagnostic ( "actual.ContainsValue(expected).Should().BeFalse();" ) ]
47
- [ NotImplemented ]
57
+ [ AssertionDataTestMethod ]
58
+ [ AssertionDiagnostic ( "actual.ContainsValue(expectedValue).Should().BeFalse({0});" ) ]
59
+ [ AssertionDiagnostic ( "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeFalse({0}).And.ToString();" ) ]
60
+ [ Implemented ]
48
61
public void DictionaryShouldNotContainValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldNotContainValueAnalyzer > ( assertion ) ;
49
62
50
- [ TestMethod ]
63
+ [ AssertionDataTestMethod ]
51
64
[ AssertionCodeFix (
52
- oldAssertion : "actual.ContainsValue(expected).Should().BeFalse();" ,
53
- newAssertion : "actual.Should().NotContainValue(expected);" ) ]
54
- [ NotImplemented ]
65
+ oldAssertion : "actual.ContainsValue(expectedValue).Should().BeFalse({0});" ,
66
+ newAssertion : "actual.Should().NotContainValue(expectedValue{0});" ) ]
67
+ [ AssertionCodeFix (
68
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeFalse({0}).And.ToString();" ,
69
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().NotContainValue(expectedValue{0}).And.ToString();" ) ]
70
+ [ Implemented ]
55
71
public void DictionaryShouldNotContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldNotContainValueCodeFix , DictionaryShouldNotContainValueAnalyzer > ( oldAssertion , newAssertion ) ;
56
72
57
- [ TestMethod ]
58
- [ AssertionDiagnostic ( "actual.Should().ContainKey(expectedKey).And.ContainValue(expectedValue);" ) ]
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();" ) ]
59
76
[ NotImplemented ]
60
77
public void DictionaryShouldContainKeyAndValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainKeyAndValueAnalyzer > ( assertion ) ;
61
78
62
- [ TestMethod ]
79
+ [ AssertionDataTestMethod ]
80
+ [ AssertionCodeFix (
81
+ oldAssertion : "actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue);" ,
82
+ newAssertion : "actual.Should().Contain(expectedKey, expectedValue{0});" ) ]
83
+ [ AssertionCodeFix (
84
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue).And.ToString();" ,
85
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
63
86
[ AssertionCodeFix (
64
- oldAssertion : "actual.Should().ContainKey(expectedKey).And.ContainValue(expectedValue);" ,
65
- newAssertion : "actual.Should().Contain(expectedKey, expectedValue);" ) ]
87
+ oldAssertion : "actual.Should().ContainKey(expectedKey).And.ContainValue(expectedValue{0});" ,
88
+ newAssertion : "actual.Should().Contain(expectedKey, expectedValue{0});" ) ]
89
+ [ AssertionCodeFix (
90
+ oldAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey).And.ContainValue(expectedValue{0}).And.ToString();" ,
91
+ newAssertion : "actual.ToDictionary(p => p.Key, p=> p.Value).Should().Contain(expectedKey, expectedValue{0}).And.ToString();" ) ]
66
92
[ NotImplemented ]
67
93
public void DictionaryShouldContainKeyAndValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainKeyAndValueCodeFix , DictionaryShouldContainKeyAndValueAnalyzer > ( oldAssertion , newAssertion ) ;
68
94
69
- [ TestMethod ]
70
- [ AssertionDiagnostic ( "actual.Should().ContainKey(expected.Key).And.ContainValue(expected.Value);" ) ]
95
+ [ 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();" ) ]
71
98
[ NotImplemented ]
72
99
public void DictionaryShouldContainPair_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainPairAnalyzer > ( assertion ) ;
73
100
74
- [ TestMethod ]
101
+ [ AssertionDataTestMethod ]
102
+ [ AssertionCodeFix (
103
+ oldAssertion : "actual.Should().ContainKey(expected.Key{0}).And.ContainValue(expected.Value);" ,
104
+ newAssertion : "actual.Should().Contain(expected{0});" ) ]
105
+ [ 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();" ) ]
108
+ [ AssertionCodeFix (
109
+ oldAssertion : "actual.Should().ContainKey(expected.Key).And.ContainValue(expected.Value{0});" ,
110
+ newAssertion : "actual.Should().Contain(expected{0});" ) ]
75
111
[ AssertionCodeFix (
76
- oldAssertion : "actual.Should().ContainKey(expected.Key).And.ContainValue(expected.Value);" ,
77
- newAssertion : "actual.Should().Contain(expected);" ) ]
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( );" ) ]
78
114
[ NotImplemented ]
79
115
public void DictionaryShouldContainPair_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainPairCodeFix , DictionaryShouldContainPairAnalyzer > ( oldAssertion , newAssertion ) ;
80
116
0 commit comments