@@ -4,6 +4,10 @@ This is a generated file, please edit src\FluentAssertions.Analyzers.FluentAsser
4
4
5
5
# FluentAssertions Analyzer Docs
6
6
7
+ - [ StringShouldStartWith] ( #scenario-stringshouldstartwith ) - ` actual.Should().StartWith(expected); `
8
+ - [ StringShouldEndWith] ( #scenario-stringshouldendwith ) - ` actual.Should().EndWith(expected); `
9
+ - [ StringShouldNotBeNullOrEmpty] ( #scenario-stringshouldnotbenullorempty ) - ` actual.Should().NotBeNullOrEmpty(); `
10
+ - [ StringShouldBeNullOrEmpty] ( #scenario-stringshouldbenullorempty ) - ` actual.Should().BeNullOrEmpty(); `
7
11
- [ CollectionShouldNotBeEmpty] ( #scenario-collectionshouldnotbeempty ) - ` collection.Should().NotBeEmpty(); `
8
12
- [ CollectionShouldBeEmpty] ( #scenario-collectionshouldbeempty ) - ` collection.Should().BeEmpty(); `
9
13
- [ CollectionShouldNotContainCondition] ( #scenario-collectionshouldnotcontaincondition ) - ` collection.Should().NotContain(i => i == 4); `
@@ -44,6 +48,118 @@ This is a generated file, please edit src\FluentAssertions.Analyzers.FluentAsser
44
48
45
49
## Scenarios
46
50
51
+ ### scenario: StringShouldStartWith
52
+
53
+ ``` cs
54
+ // arrange
55
+ var actual = " actual" ;
56
+ var expected = " act" ;
57
+
58
+ // old assertion:
59
+ actual .StartsWith (expected ).Should ().BeTrue ();
60
+
61
+ // new assertion:
62
+ actual .Should ().StartWith (expected );
63
+ ```
64
+
65
+ #### Failure messages
66
+
67
+ ``` cs
68
+ // arrange
69
+ var actual = " actual" ;
70
+ var expected = " wrong" ;
71
+
72
+ // old assertion:
73
+ actual .StartsWith (expected ).Should ().BeTrue (); // fail message: Expected actual.StartsWith(expected) to be True, but found False.
74
+
75
+ // new assertion:
76
+ actual .Should ().StartWith (expected ); // fail message: Expected actual to start with "wrong", but "actual" differs near "act" (index 0).
77
+ ```
78
+
79
+ ### scenario: StringShouldEndWith
80
+
81
+ ``` cs
82
+ // arrange
83
+ var actual = " actual" ;
84
+ var expected = " ual" ;
85
+
86
+ // old assertion:
87
+ actual .EndsWith (expected ).Should ().BeTrue ();
88
+
89
+ // new assertion:
90
+ actual .Should ().EndWith (expected );
91
+ ```
92
+
93
+ #### Failure messages
94
+
95
+ ``` cs
96
+ // arrange
97
+ var actual = " actual" ;
98
+ var expected = " wrong" ;
99
+
100
+ // old assertion:
101
+ actual .EndsWith (expected ).Should ().BeTrue (); // fail message: Expected actual.EndsWith(expected) to be True, but found False.
102
+
103
+ // new assertion:
104
+ actual .Should ().EndWith (expected ); // fail message: Expected actual "actual" to end with "wrong".
105
+ ```
106
+
107
+ ### scenario: StringShouldNotBeNullOrEmpty
108
+
109
+ ``` cs
110
+ // arrange
111
+ var actual = " actual" ;
112
+
113
+ // old assertion:
114
+ string .IsNullOrEmpty (actual ).Should ().BeFalse ();
115
+ actual .Should ().NotBeNull ().And .NotBeEmpty ();
116
+ actual .Should ().NotBeEmpty ().And .NotBeNull ();
117
+
118
+ // new assertion:
119
+ actual .Should ().NotBeNullOrEmpty ();
120
+ ```
121
+
122
+ #### Failure messages
123
+
124
+ ``` cs
125
+ // arrange
126
+ var actual = string .Empty ;
127
+
128
+ // old assertion:
129
+ string .IsNullOrEmpty (actual ).Should ().BeFalse (); // fail message: Expected string.IsNullOrEmpty(actual) to be False, but found True.
130
+ actual .Should ().NotBeNull ().And .NotBeEmpty (); // fail message: Did not expect actual to be empty.
131
+ actual .Should ().NotBeEmpty ().And .NotBeNull (); // fail message: Did not expect actual to be empty.
132
+
133
+ // new assertion:
134
+ actual .Should ().NotBeNullOrEmpty (); // fail message: Expected actual not to be <null> or empty, but found "".
135
+ ```
136
+
137
+ ### scenario: StringShouldBeNullOrEmpty
138
+
139
+ ``` cs
140
+ // arrange
141
+ var actual = string .Empty ;
142
+
143
+ // old assertion:
144
+ string .IsNullOrEmpty (actual ).Should ().BeTrue ();
145
+
146
+ // new assertion:
147
+ actual .Should ().BeNullOrEmpty ();
148
+ ```
149
+
150
+ #### Failure messages
151
+
152
+ ``` cs
153
+ // arrange
154
+ var actual = " actual" ;
155
+
156
+ // old assertion:
157
+ string .IsNullOrEmpty (actual ).Should ().BeTrue (); // fail message: Expected string.IsNullOrEmpty(actual) to be True, but found False.
158
+
159
+ // new assertion:
160
+ actual .Should ().BeNullOrEmpty (); // fail message: Expected actual to be <null> or empty, but found "actual".
161
+ ```
162
+
47
163
### scenario: CollectionShouldNotBeEmpty
48
164
49
165
``` cs
@@ -64,7 +180,7 @@ collection.Should().NotBeEmpty();
64
180
var collection = new List <int > { };
65
181
66
182
// old assertion:
67
- collection .Any ().Should ().BeTrue (); // fail message: Expected collection.Any() to be true , but found False.
183
+ collection .Any ().Should ().BeTrue (); // fail message: Expected collection.Any() to be True , but found False.
68
184
69
185
// new assertion:
70
186
collection .Should ().NotBeEmpty (); // fail message: Expected collection not to be empty.
@@ -93,13 +209,13 @@ collection.Should().BeEmpty();
93
209
var collection = new List <int > { 1 , 2 , 3 };
94
210
95
211
// old assertion:
96
- collection .Any ().Should ().BeFalse (); // fail message: Expected collection.Any() to be false , but found True.
212
+ collection .Any ().Should ().BeFalse (); // fail message: Expected collection.Any() to be False , but found True.
97
213
collection .Count ().Should ().Be (0 ); // fail message: Expected collection.Count() to be 0, but found 3 (difference of 3).
98
214
collection .Count .Should ().Be (0 ); // fail message: Expected collection.Count to be 0, but found 3 (difference of 3).
99
215
collection .Should ().HaveCount (0 ); // fail message: Expected collection to contain 0 item(s), but found 3: {1, 2, 3}.
100
216
101
217
// new assertion:
102
- collection .Should ().BeEmpty (); // fail message: Expected collection to be empty, but found {1, 2, 3 }.
218
+ collection .Should ().BeEmpty (); // fail message: Expected collection to be empty, but found at least one item {1 }.
103
219
```
104
220
105
221
### scenario: CollectionShouldNotContainCondition
@@ -123,8 +239,8 @@ collection.Should().NotContain(i => i == 4);
123
239
var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
124
240
125
241
// old assertion:
126
- collection .Any (i => i == 4 ).Should ().BeFalse (); // fail message: Expected collection.Any(i => i == 4) to be false , but found True.
127
- collection .Where (i => i == 4 ).Should ().BeEmpty (); // fail message: Expected collection.Where(i => i == 4) to be empty, but found {4}.
242
+ collection .Any (i => i == 4 ).Should ().BeFalse (); // fail message: Expected collection.Any(i => i == 4) to be False , but found True.
243
+ collection .Where (i => i == 4 ).Should ().BeEmpty (); // fail message: Expected collection.Where(i => i == 4) to be empty, but found at least one item {4}.
128
244
129
245
// new assertion:
130
246
collection .Should ().NotContain (i => i == 4 ); // fail message: Expected collection {1, 2, 3, 4, 5} to not have any items matching (i == 4), but found {4}.
@@ -150,7 +266,7 @@ collection.Should().NotContain(4);
150
266
var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
151
267
152
268
// old assertion:
153
- collection .Contains (4 ).Should ().BeFalse (); // fail message: Expected collection.Contains(4) to be false , but found True.
269
+ collection .Contains (4 ).Should ().BeFalse (); // fail message: Expected collection.Contains(4) to be False , but found True.
154
270
155
271
// new assertion:
156
272
collection .Should ().NotContain (4 ); // fail message: Expected collection {1, 2, 3, 4, 5} to not contain 4.
@@ -176,7 +292,7 @@ collection.Should().OnlyContain(x => x > 0);
176
292
var collection = new List <int > { 1 , 2 , 3 , - 1 };
177
293
178
294
// old assertion:
179
- collection .All (x => x > 0 ).Should ().BeTrue (); // fail message: Expected collection.All(x => x > 0) to be true , but found False.
295
+ collection .All (x => x > 0 ).Should ().BeTrue (); // fail message: Expected collection.All(x => x > 0) to be True , but found False.
180
296
181
297
// new assertion:
182
298
collection .Should ().OnlyContain (x => x > 0 ); // fail message: Expected collection to contain only items matching (x > 0), but {-1} do(es) not match.
@@ -202,7 +318,7 @@ collection.Should().Contain(2);
202
318
var collection = new List <int > { 1 , 3 , 4 , 5 };
203
319
204
320
// old assertion:
205
- collection .Contains (2 ).Should ().BeTrue (); // fail message: Expected collection.Contains(2) to be true , but found False.
321
+ collection .Contains (2 ).Should ().BeTrue (); // fail message: Expected collection.Contains(2) to be True , but found False.
206
322
207
323
// new assertion:
208
324
collection .Should ().Contain (2 ); // fail message: Expected collection {1, 3, 4, 5} to contain 2.
@@ -229,7 +345,7 @@ collection.Should().Contain(i => i == 2);
229
345
var collection = new List <int > { 3 , 4 , 5 };
230
346
231
347
// old assertion:
232
- collection .Any (i => i == 2 ).Should ().BeTrue (); // fail message: Expected collection.Any(i => i == 2) to be true , but found False.
348
+ collection .Any (i => i == 2 ).Should ().BeTrue (); // fail message: Expected collection.Any(i => i == 2) to be True , but found False.
233
349
collection .Where (i => i == 2 ).Should ().NotBeEmpty (); // fail message: Expected collection.Where(i => i == 2) not to be empty.
234
350
235
351
// new assertion:
@@ -580,7 +696,7 @@ dictionary.Should().ContainKey("two");
580
696
var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" three" ] = 3 };
581
697
582
698
// old assertion:
583
- dictionary .ContainsKey (" two" ).Should ().BeTrue (); // fail message: Expected dictionary.ContainsKey("two") to be true , but found False.
699
+ dictionary .ContainsKey (" two" ).Should ().BeTrue (); // fail message: Expected dictionary.ContainsKey("two") to be True , but found False.
584
700
585
701
// new assertion:
586
702
dictionary .Should ().ContainKey (" two" ); // fail message: Expected dictionary {["one"] = 1, ["three"] = 3} to contain key "two".
@@ -606,7 +722,7 @@ dictionary.Should().NotContainKey("four");
606
722
var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" two" ] = 2 , [" three" ] = 3 , [" four" ] = 4 };
607
723
608
724
// old assertion:
609
- dictionary .ContainsKey (" four" ).Should ().BeFalse (); // fail message: Expected dictionary.ContainsKey("four") to be false , but found True.
725
+ dictionary .ContainsKey (" four" ).Should ().BeFalse (); // fail message: Expected dictionary.ContainsKey("four") to be False , but found True.
610
726
611
727
// new assertion:
612
728
dictionary .Should ().NotContainKey (" four" ); // fail message: Expected dictionary {["one"] = 1, ["two"] = 2, ["three"] = 3, ["four"] = 4} not to contain key "four", but found it anyhow.
@@ -632,7 +748,7 @@ dictionary.Should().ContainValue(2);
632
748
var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" two" ] = 2 , [" three" ] = 3 };
633
749
634
750
// old assertion:
635
- dictionary .ContainsValue (4 ).Should ().BeTrue (); // fail message: Expected dictionary.ContainsValue(4) to be true , but found False.
751
+ dictionary .ContainsValue (4 ).Should ().BeTrue (); // fail message: Expected dictionary.ContainsValue(4) to be True , but found False.
636
752
637
753
// new assertion:
638
754
dictionary .Should ().ContainValue (4 ); // fail message: Expected dictionary {["one"] = 1, ["two"] = 2, ["three"] = 3} to contain value 4.
@@ -658,7 +774,7 @@ dictionary.Should().NotContainValue(4);
658
774
var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" two" ] = 2 , [" three" ] = 3 , [" four" ] = 4 };
659
775
660
776
// old assertion:
661
- dictionary .ContainsValue (4 ).Should ().BeFalse (); // fail message: Expected dictionary.ContainsValue(4) to be false , but found True.
777
+ dictionary .ContainsValue (4 ).Should ().BeFalse (); // fail message: Expected dictionary.ContainsValue(4) to be False , but found True.
662
778
663
779
// new assertion:
664
780
dictionary .Should ().NotContainValue (4 ); // fail message: Expected dictionary {["one"] = 1, ["two"] = 2, ["three"] = 3, ["four"] = 4} not to contain value 4, but found it anyhow.
0 commit comments