@@ -40,6 +40,7 @@ collection.Should().NotBeEmpty();
40
40
41
41
``` cs
42
42
// arrange
43
+ var collection = new List <int > { };
43
44
44
45
// old assertion:
45
46
collection .Any ().Should ().BeTrue (); // fail message: Expected collection.Any() to be true, but found False.
@@ -68,6 +69,7 @@ collection.Should().BeEmpty();
68
69
69
70
``` cs
70
71
// arrange
72
+ var collection = new List <int > { 1 , 2 , 3 };
71
73
72
74
// old assertion:
73
75
collection .Any ().Should ().BeFalse (); // fail message: Expected collection.Any() to be false, but found True.
@@ -97,6 +99,7 @@ collection.Should().NotContain(i => i == 4);
97
99
98
100
``` cs
99
101
// arrange
102
+ var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
100
103
101
104
// old assertion:
102
105
collection .Any (i => i == 4 ).Should ().BeFalse (); // fail message: Expected collection.Any(i => i == 4) to be false, but found True.
@@ -123,6 +126,7 @@ collection.Should().NotContain(4);
123
126
124
127
``` cs
125
128
// arrange
129
+ var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
126
130
127
131
// old assertion:
128
132
collection .Contains (4 ).Should ().BeFalse (); // fail message: Expected collection.Contains(4) to be false, but found True.
@@ -148,6 +152,7 @@ collection.Should().OnlyContain(x => x > 0);
148
152
149
153
``` cs
150
154
// arrange
155
+ var collection = new List <int > { 1 , 2 , 3 , - 1 };
151
156
152
157
// old assertion:
153
158
collection .All (x => x > 0 ).Should ().BeTrue (); // fail message: Expected collection.All(x => x > 0) to be true, but found False.
@@ -173,6 +178,7 @@ collection.Should().Contain(2);
173
178
174
179
``` cs
175
180
// arrange
181
+ var collection = new List <int > { 1 , 3 , 4 , 5 };
176
182
177
183
// old assertion:
178
184
collection .Contains (2 ).Should ().BeTrue (); // fail message: Expected collection.Contains(2) to be true, but found False.
@@ -199,6 +205,7 @@ collection.Should().Contain(i => i == 2);
199
205
200
206
``` cs
201
207
// arrange
208
+ var collection = new List <int > { 3 , 4 , 5 };
202
209
203
210
// old assertion:
204
211
collection .Any (i => i == 2 ).Should ().BeTrue (); // fail message: Expected collection.Any(i => i == 2) to be true, but found False.
@@ -226,6 +233,7 @@ collection.Should().HaveCount(3);
226
233
227
234
``` cs
228
235
// arrange
236
+ var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
229
237
230
238
// old assertion:
231
239
collection .Count ().Should ().Be (3 ); // fail message: Expected collection.Count() to be 3, but found 5.
@@ -252,6 +260,7 @@ collection.Should().HaveCount(3);
252
260
253
261
``` cs
254
262
// arrange
263
+ var collection = new int [] { 1 , 2 , 3 , 4 , 5 };
255
264
256
265
// old assertion:
257
266
collection .Length .Should ().Be (3 ); // fail message: Expected collection.Length to be 3, but found 5.
@@ -277,6 +286,7 @@ collection.Should().NotHaveCount(4);
277
286
278
287
``` cs
279
288
// arrange
289
+ var collection = new List <int > { 1 , 2 , 3 , 4 };
280
290
281
291
// old assertion:
282
292
collection .Count ().Should ().NotBe (4 ); // fail message: Did not expect collection.Count() to be 4.
@@ -304,6 +314,7 @@ collection.Should().ContainSingle();
304
314
305
315
``` cs
306
316
// arrange
317
+ var collection = new List <int > { 1 , 2 , 3 };
307
318
308
319
// old assertion:
309
320
collection .Count ().Should ().Be (1 ); // fail message: Expected collection.Count() to be 1, but found 3.
@@ -331,6 +342,7 @@ collection.Should().HaveCountGreaterThan(2);
331
342
332
343
``` cs
333
344
// arrange
345
+ var collection = new List <int > { 1 };
334
346
335
347
// old assertion:
336
348
collection .Count ().Should ().BeGreaterThan (2 ); // fail message: Expected collection.Count() to be greater than 2, but found 1.
@@ -356,6 +368,7 @@ collection.Should().HaveCountGreaterOrEqualTo(3);
356
368
357
369
``` cs
358
370
// arrange
371
+ var collection = new List <int > { 1 , 2 };
359
372
360
373
// old assertion:
361
374
collection .Count ().Should ().BeGreaterOrEqualTo (3 ); // fail message: Expected collection.Count() to be greater than or equal to 3, but found 2.
@@ -381,6 +394,7 @@ collection.Should().HaveCountLessThan(4);
381
394
382
395
``` cs
383
396
// arrange
397
+ var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
384
398
385
399
// old assertion:
386
400
collection .Count ().Should ().BeLessThan (4 ); // fail message: Expected collection.Count() to be less than 4, but found 5.
@@ -406,6 +420,7 @@ collection.Should().HaveCountLessOrEqualTo(3);
406
420
407
421
``` cs
408
422
// arrange
423
+ var collection = new List <int > { 1 , 2 , 3 , 4 };
409
424
410
425
// old assertion:
411
426
collection .Count ().Should ().BeLessOrEqualTo (3 ); // fail message: Expected collection.Count() to be less than or equal to 3, but found 4.
@@ -432,6 +447,7 @@ collection.Should().HaveSameCount(otherCollection);
432
447
433
448
``` cs
434
449
// arrange
450
+ var collection = new List <int > { 1 , 2 , 3 };
435
451
436
452
// old assertion:
437
453
collection .Should ().HaveCount (otherCollection .Count ()); // fail message: Expected collection to contain 4 item(s), but found 3: {1, 2, 3}.
@@ -458,6 +474,7 @@ collection.Should().NotHaveSameCount(otherCollection);
458
474
459
475
``` cs
460
476
// arrange
477
+ var collection = new List <int > { 1 , 2 , 3 };
461
478
462
479
// old assertion:
463
480
collection .Count ().Should ().NotBe (otherCollection .Count ()); // fail message: Did not expect collection.Count() to be 3.
@@ -483,6 +500,7 @@ collection.Should().ContainSingle(i => i == 1);
483
500
484
501
``` cs
485
502
// arrange
503
+ var collection = new List <int > { 1 , 2 , 3 , 1 };
486
504
487
505
// old assertion:
488
506
collection .Where (i => i == 1 ).Should ().HaveCount (1 ); // fail message: Expected collection.Where(i => i == 1) to contain 1 item(s), but found 2: {1, 1}.
@@ -509,6 +527,7 @@ collection.Should().NotBeNullOrEmpty();
509
527
510
528
``` cs
511
529
// arrange
530
+ var collection = new List <int >();
512
531
513
532
// old assertion:
514
533
collection .Should ().NotBeEmpty ().And .NotBeNull (); // fail message: Expected collection not to be empty.
0 commit comments