@@ -4,6 +4,10 @@ This is a generated file, please edit src\FluentAssertions.Analyzers.FluentAsser
44
55# FluentAssertions Analyzer Docs
66
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(); `
711- [ CollectionShouldNotBeEmpty] ( #scenario-collectionshouldnotbeempty ) - ` collection.Should().NotBeEmpty(); `
812- [ CollectionShouldBeEmpty] ( #scenario-collectionshouldbeempty ) - ` collection.Should().BeEmpty(); `
913- [ CollectionShouldNotContainCondition] ( #scenario-collectionshouldnotcontaincondition ) - ` collection.Should().NotContain(i => i == 4); `
@@ -44,6 +48,118 @@ This is a generated file, please edit src\FluentAssertions.Analyzers.FluentAsser
4448
4549## Scenarios
4650
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+
47163### scenario: CollectionShouldNotBeEmpty
48164
49165``` cs
@@ -64,7 +180,7 @@ collection.Should().NotBeEmpty();
64180var collection = new List <int > { };
65181
66182// 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.
68184
69185// new assertion:
70186collection .Should ().NotBeEmpty (); // fail message: Expected collection not to be empty.
@@ -93,13 +209,13 @@ collection.Should().BeEmpty();
93209var collection = new List <int > { 1 , 2 , 3 };
94210
95211// 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.
97213collection .Count ().Should ().Be (0 ); // fail message: Expected collection.Count() to be 0, but found 3 (difference of 3).
98214collection .Count .Should ().Be (0 ); // fail message: Expected collection.Count to be 0, but found 3 (difference of 3).
99215collection .Should ().HaveCount (0 ); // fail message: Expected collection to contain 0 item(s), but found 3: {1, 2, 3}.
100216
101217// 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 }.
103219```
104220
105221### scenario: CollectionShouldNotContainCondition
@@ -123,8 +239,8 @@ collection.Should().NotContain(i => i == 4);
123239var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
124240
125241// 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}.
128244
129245// new assertion:
130246collection .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);
150266var collection = new List <int > { 1 , 2 , 3 , 4 , 5 };
151267
152268// 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.
154270
155271// new assertion:
156272collection .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);
176292var collection = new List <int > { 1 , 2 , 3 , - 1 };
177293
178294// 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.
180296
181297// new assertion:
182298collection .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);
202318var collection = new List <int > { 1 , 3 , 4 , 5 };
203319
204320// 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.
206322
207323// new assertion:
208324collection .Should ().Contain (2 ); // fail message: Expected collection {1, 3, 4, 5} to contain 2.
@@ -229,7 +345,7 @@ collection.Should().Contain(i => i == 2);
229345var collection = new List <int > { 3 , 4 , 5 };
230346
231347// 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.
233349collection .Where (i => i == 2 ).Should ().NotBeEmpty (); // fail message: Expected collection.Where(i => i == 2) not to be empty.
234350
235351// new assertion:
@@ -580,7 +696,7 @@ dictionary.Should().ContainKey("two");
580696var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" three" ] = 3 };
581697
582698// 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.
584700
585701// new assertion:
586702dictionary .Should ().ContainKey (" two" ); // fail message: Expected dictionary {["one"] = 1, ["three"] = 3} to contain key "two".
@@ -606,7 +722,7 @@ dictionary.Should().NotContainKey("four");
606722var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" two" ] = 2 , [" three" ] = 3 , [" four" ] = 4 };
607723
608724// 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.
610726
611727// new assertion:
612728dictionary .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);
632748var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" two" ] = 2 , [" three" ] = 3 };
633749
634750// 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.
636752
637753// new assertion:
638754dictionary .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);
658774var dictionary = new Dictionary <string , int > { [" one" ] = 1 , [" two" ] = 2 , [" three" ] = 3 , [" four" ] = 4 };
659775
660776// 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.
662778
663779// new assertion:
664780dictionary .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