@@ -6,75 +6,111 @@ namespace FluentAssertions.BestPractices.Tests
66 [ TestClass ]
77 public class DictionaryTests
88 {
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 ]
1213 public void DictionaryShouldContainKey_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainKeyAnalyzer > ( assertion ) ;
1314
14- [ TestMethod ]
15+ [ AssertionDataTestMethod ]
1516 [ 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 ]
1923 public void DictionaryShouldContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainKeyCodeFix , DictionaryShouldContainKeyAnalyzer > ( oldAssertion , newAssertion ) ;
2024
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 ]
2429 public void DictionaryShouldNotContainKey_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldNotContainKeyAnalyzer > ( assertion ) ;
2530
26- [ TestMethod ]
31+ [ AssertionDataTestMethod ]
2732 [ 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 ]
3139 public void DictionaryShouldNotContainKey_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldNotContainKeyCodeFix , DictionaryShouldNotContainKeyAnalyzer > ( oldAssertion , newAssertion ) ;
3240
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 ]
3645 public void DictionaryShouldContainValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainValueAnalyzer > ( assertion ) ;
3746
38- [ TestMethod ]
47+ [ AssertionDataTestMethod ]
3948 [ 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 ]
4355 public void DictionaryShouldContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainValueCodeFix , DictionaryShouldContainValueAnalyzer > ( oldAssertion , newAssertion ) ;
4456
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 ]
4861 public void DictionaryShouldNotContainValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldNotContainValueAnalyzer > ( assertion ) ;
4962
50- [ TestMethod ]
63+ [ AssertionDataTestMethod ]
5164 [ 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 ]
5571 public void DictionaryShouldNotContainValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldNotContainValueCodeFix , DictionaryShouldNotContainValueAnalyzer > ( oldAssertion , newAssertion ) ;
5672
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();" ) ]
5976 [ NotImplemented ]
6077 public void DictionaryShouldContainKeyAndValue_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainKeyAndValueAnalyzer > ( assertion ) ;
6178
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();" ) ]
6386 [ 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();" ) ]
6692 [ NotImplemented ]
6793 public void DictionaryShouldContainKeyAndValue_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainKeyAndValueCodeFix , DictionaryShouldContainKeyAndValueAnalyzer > ( oldAssertion , newAssertion ) ;
6894
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();" ) ]
7198 [ NotImplemented ]
7299 public void DictionaryShouldContainPair_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < DictionaryShouldContainPairAnalyzer > ( assertion ) ;
73100
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});" ) ]
75111 [ 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( );" ) ]
78114 [ NotImplemented ]
79115 public void DictionaryShouldContainPair_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < DictionaryShouldContainPairCodeFix , DictionaryShouldContainPairAnalyzer > ( oldAssertion , newAssertion ) ;
80116
0 commit comments