Skip to content

Commit 2e568f6

Browse files
committed
Update FluentAssertions library to latest.
1 parent 8044b1a commit 2e568f6

26 files changed

+75
-76
lines changed

Source/Bogus.Tests/Bogus.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88
<ItemGroup>
99
<PackageReference Include="Appveyor.Testlogger" Version="2.0.0" />
10-
<PackageReference Include="FluentAssertions" Version="4.19.4" />
10+
<PackageReference Include="FluentAssertions" Version="5.10.3" />
1111
<PackageReference Include="morelinq" Version="3.0.0" />
1212
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
1313
<PackageReference Include="Rant" Version="3.0.530" />

Source/Bogus.Tests/BsonTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void should_be_able_to_reset_a_locale()
5959

6060
Action error = () => extra.JunkFood().Should().Be("Pizza");
6161

62-
error.ShouldThrow<NullReferenceException>();
62+
error.Should().Throw<NullReferenceException>();
6363
}
6464

6565

@@ -135,4 +135,4 @@ private BObject CreateExtraData()
135135
}
136136
}
137137

138-
}
138+
}

Source/Bogus.Tests/CloneTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void can_create_a_simple_clone()
2020

2121
var rootOrder = orderFaker.Generate();
2222

23-
clonedOrder.ShouldBeEquivalentTo(rootOrder);
23+
clonedOrder.Should().BeEquivalentTo(rootOrder);
2424
}
2525

2626
[Fact]

Source/Bogus.Tests/DataSetTests/CommerceTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ public void can_get_a_product_description()
5252
[Fact]
5353
public void can_get_categories()
5454
{
55-
commerce.Categories(3).ShouldBeEquivalentTo(
56-
new[] {"Kids", "Music", "Jewelery"});
55+
commerce.Categories(3).Should().BeEquivalentTo(new[] {"Kids", "Music", "Jewelery"}, opt => opt.WithStrictOrdering());
5756
}
5857

5958
[Fact]

Source/Bogus.Tests/DataSetTests/FinanceTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ public void can_generate_iban2()
8585
public void iban_throws_key_not_found_on_invalid_iso3166()
8686
{
8787
Action a = () => finance.Iban(countryCode: "zz");
88-
a.ShouldThrow<KeyNotFoundException>();
88+
a.Should().Throw<KeyNotFoundException>();
8989
}
9090

9191
[Fact]
9292
public void iban_thows_on_invalid_iso3166_length()
9393
{
9494
Action a = () => finance.Iban(countryCode: "fff");
95-
a.ShouldThrow<ArgumentOutOfRangeException>();
95+
a.Should().Throw<ArgumentOutOfRangeException>();
9696
}
9797

9898
[Fact]
@@ -194,4 +194,4 @@ private static bool Luhn(string digits)
194194
).Sum() % 10 == 0;
195195
}
196196
}
197-
}
197+
}

Source/Bogus.Tests/DataSetTests/InternetTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void can_pick_random_browser()
167167
foreach( var userAgent in userAgents )
168168
{
169169
Action act = () => req.Headers.Add("User-Agent", userAgent);
170-
act.ShouldNotThrow();
170+
act.Should().NotThrow();
171171
}
172172
}
173173

@@ -181,4 +181,4 @@ public void can_get_username_with_unicode_characters(string first, string last,
181181
internet.UserNameUnicode(first, last).Should().Be(expected);
182182
}
183183
}
184-
}
184+
}

Source/Bogus.Tests/ExtensionTests/RegistrationPlateExtensionsForGreatBritainTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void reject_registration_date_before_current_style()
2323
var vehicle = new Vehicle();
2424

2525
Action a = () => vehicle.GbRegistrationPlate(new DateTime(2001, 8, 31), new DateTime(2019, 7, 5));
26-
a.ShouldThrow<ArgumentOutOfRangeException>()
26+
a.Should().Throw<ArgumentOutOfRangeException>()
2727
.Where(ex => ex.Message.StartsWith("Can only accept registration dates between 2001-09-01 and 2051-02-28."))
2828
.Where(ex => ex.ParamName == "dateFrom");
2929
}
@@ -33,7 +33,7 @@ public void reject_registration_date_after_current_style()
3333
{
3434
var vehicle = new Vehicle();
3535
Action a = () => vehicle.GbRegistrationPlate(new DateTime(2019, 7, 5), new DateTime(2051, 9, 1));
36-
a.ShouldThrow<ArgumentOutOfRangeException>()
36+
a.Should().Throw<ArgumentOutOfRangeException>()
3737
.Where( ex => ex.Message.StartsWith("Can only accept registration dates between 2001-09-01 and 2051-02-28."))
3838
.Where( ex => ex.ParamName == "dateTo" );
3939
}
@@ -113,4 +113,4 @@ public void export_plates_have_pseudo_location_marker_based_on_registration_date
113113
plate.Should().StartWith(partialPlate);
114114
}
115115
}
116-
}
116+
}

Source/Bogus.Tests/FluentTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void Should_Throw_Exception_If_RuleForType_Types_Dont_Match()
199199
.RuleForType(typeof(int), f => f.Random.Word());
200200
};
201201

202-
action.ShouldThrow<ArgumentException>();
202+
action.Should().Throw<ArgumentException>();
203203
}
204204

205205
[Fact]
@@ -416,4 +416,4 @@ public void can_generate_forever()
416416
}
417417
}
418418
}
419-
}
419+
}

Source/Bogus.Tests/GitHubIssues/Issue115.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void should_throw_with_nested_expression()
2828
Action fakerMaker = () => new Faker<Customer>()
2929
.RuleFor(o => o.Order.Item, f => f.Random.Int(1, 1000).ToString());
3030

31-
fakerMaker.ShouldThrow<ArgumentException>();
31+
fakerMaker.Should().Throw<ArgumentException>();
3232

3333
}
3434

@@ -62,4 +62,4 @@ public void calling_finish_with_twice_is_okay()
6262
console.Dump(order);
6363
}
6464
}
65-
}
65+
}

Source/Bogus.Tests/GitHubIssues/Issue132.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ public class Issue132 : SeededTest
1313
public void should_throw_exception_on_invalid_locale_dataset()
1414
{
1515
Action a = () => new Lorem("wtf_locale");
16-
a.ShouldThrow<BogusException>();
16+
a.Should().Throw<BogusException>();
1717
}
1818

1919
[Fact]
2020
public void should_throw_exception_on_invalid_locale_with_faker_t()
2121
{
2222
Action a = () => new Faker<Models.Order>("yo yo yo");
2323

24-
a.ShouldThrow<BogusException>();
24+
a.Should().Throw<BogusException>();
2525
}
2626

2727
[Fact]
2828
public void should_throw_exception_on_invalid_locate_with_faker()
2929
{
3030
Action a = () => new Faker("fe fi fo fum");
3131

32-
a.ShouldThrow<BogusException>();
32+
a.Should().Throw<BogusException>();
3333
}
3434

3535
[Fact]
@@ -42,7 +42,7 @@ public void ensure_the_project_url_exists()
4242
//test exists here because we're using AssemblyDescription attribute
4343
//and in case that changes, we need to be aware of it.
4444

45-
a.ShouldThrow<BogusException>()
45+
a.Should().Throw<BogusException>()
4646
.And.Message
4747
.Should().Contain("https://github.com/bchavez/Bogus");
4848

@@ -166,4 +166,4 @@ public void de_locale()
166166
.Should().Be("de");
167167
}
168168
}
169-
}
169+
}

Source/Bogus.Tests/GitHubIssues/Issue218.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void global_strict_mode_should_throw_on_incomplete_rules()
1717

1818
Action gen = () => orderFaker.Generate();
1919

20-
gen.ShouldThrow<ValidationException>();
20+
gen.Should().Throw<ValidationException>();
2121

2222
Faker.DefaultStrictMode = false;
2323
}
@@ -33,7 +33,7 @@ public void local_struct_mode_faker_t_scope_should_throw_on_incomplete_rules()
3333

3434
Action gen = () => orderFaker.Generate();
3535

36-
gen.ShouldThrow<ValidationException>();
36+
gen.Should().Throw<ValidationException>();
3737
}
3838

3939

@@ -48,9 +48,9 @@ public void local_strict_mode_should_take_precedence_always()
4848

4949
Action gen = () => orderFaker.Generate();
5050

51-
gen.ShouldNotThrow<ValidationException>();
51+
gen.Should().NotThrow<ValidationException>();
5252

5353
Faker.DefaultStrictMode = false;
5454
}
5555
}
56-
}
56+
}

Source/Bogus.Tests/GitHubIssues/Issue253.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void rulefor_a_field_that_doesnt_exist_throws()
3434

3535
Action act = () => orderFaker.RuleFor("fffff", f => f.Random.Number());
3636

37-
act.ShouldThrow<ArgumentException>();
37+
act.Should().Throw<ArgumentException>();
3838
}
3939

4040
[Fact]
@@ -54,7 +54,7 @@ public void ignoring_a_field_that_doesnt_exist_throws()
5454

5555
Action act = () => orderFaker.RuleFor("hhhhh", f => f.Random.Number());
5656

57-
act.ShouldThrow<ArgumentException>();
57+
act.Should().Throw<ArgumentException>();
5858
}
5959

6060
[Fact]
@@ -72,4 +72,4 @@ public void should_be_able_to_use_rulefor_with_typeT()
7272
order.Item.Should().Be("0Computer");
7373
}
7474
}
75-
}
75+
}

Source/Bogus.Tests/GitHubIssues/Issue255.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void explicit_interface_properties_in_child_interfaces_should_throw_when_
5353
.RuleFor(e => e.City, f => f.Address.City());
5454

5555
Action act = () => childFaker.AssertConfigurationIsValid();
56-
act.ShouldThrow<ValidationException>();
56+
act.Should().Throw<ValidationException>();
5757
}
5858

5959
[Fact]
@@ -65,7 +65,7 @@ public void explicit_interface_properties_in_child_interfaces_should_throw_when_
6565
.RuleFor(e => e.Name, f => f.Address.City());
6666

6767
Action act = () => childFaker.AssertConfigurationIsValid();
68-
act.ShouldThrow<ValidationException>();
68+
act.Should().Throw<ValidationException>();
6969
}
7070

7171
public class ChildWithNormalInterface : IChild

Source/Bogus.Tests/GitHubIssues/Issue279.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public void redefine_ordering_other_than_initial_order_of_faker_t_rules_throws_b
122122
//defined order.
123123
Action generate = () => barFaker.Generate();
124124

125-
generate.ShouldThrow<NullReferenceException>();
125+
generate.Should().Throw<NullReferenceException>();
126126
}
127127

128128
[Fact]
@@ -289,4 +289,4 @@ public static MultiDictionary<T, U, V> Clone<T, U, V>(this MultiDictionary<T, U,
289289
}
290290
}
291291

292-
}
292+
}

Source/Bogus.Tests/GitHubIssues/Issue280.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void automatic_type_conversion_fails_by_default()
2525

2626
Action generate = () => fooFaker.Generate();
2727

28-
generate.ShouldThrow<ArgumentException>();
28+
generate.Should().Throw<ArgumentException>();
2929
}
3030

3131
[Fact]
@@ -91,4 +91,4 @@ private object ConvertValue(string propertyOrField, object initialValue)
9191
}
9292
}
9393
}
94-
}
94+
}

Source/Bogus.Tests/GitHubIssues/Issue309.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void ruleforlist_addrange()
4040

4141
console.Dump(user);
4242
user.Hobbies.Should().HaveCount(3);
43-
user.Hobbies.ShouldAllBeEquivalentTo(expected, opt => opt.WithStrictOrdering());
43+
user.Hobbies.Should().BeEquivalentTo(expected, opt => opt.WithStrictOrdering());
4444
}
4545

4646
public class Hobby

Source/Bogus.Tests/GitHubIssues/Issue49.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public void issue_49_pr_51_pick_random_subset()
1616

1717
Action bounds1 = () => { f.PickRandom(items, 25).ToList(); };
1818

19-
bounds1.ShouldThrow<ArgumentOutOfRangeException>();
19+
bounds1.Should().Throw<ArgumentOutOfRangeException>();
2020

2121
Action bounds2 = () => { f.PickRandom(items, -1).ToList(); };
2222

23-
bounds2.ShouldThrow<ArgumentOutOfRangeException>();
23+
bounds2.Should().Throw<ArgumentOutOfRangeException>();
2424

2525
var picked = f.PickRandom(items, 4).ToArray();
2626
picked.Dump();
2727
picked.Should().Equal(7, 2, 9, 8);
2828
}
2929
}
30-
}
30+
}

Source/Bogus.Tests/GitHubIssues/PullRequest149.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void ensure_arabic_locale_exists()
1111
{
1212
Action a = () => new Faker("ar");
1313

14-
a.ShouldNotThrow();
14+
a.Should().NotThrow();
1515
}
1616
}
17-
}
17+
}

Source/Bogus.Tests/HandlebarsTests/ArgumentsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void unmached_brace_should_throw()
126126
var faker = new Faker();
127127
//easy to miss the closing ) with }} handle bars.
128128
Action a = () => faker.Parse("{{randomizer.number(100 }}");
129-
a.ShouldThrow<ArgumentException>();
129+
a.Should().Throw<ArgumentException>();
130130
}
131131

132132
[Fact]
@@ -138,4 +138,4 @@ public void can_parse_timespan_with_arguments()
138138
.Should().Be("00:00:15.0880571");
139139
}
140140
}
141-
}
141+
}

Source/Bogus.Tests/PersonTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public void can_use_local_seed_for_person()
230230
p1.Gender.Should().Be(p2.Gender);
231231
p1.Website.Should().Be(p2.Website);
232232

233-
p1.ShouldBeEquivalentTo(p2);
233+
p1.Should().BeEquivalentTo(p2);
234234

235235
Date.SystemClock = () => DateTime.Now;
236236
}

0 commit comments

Comments
 (0)