Skip to content

Commit

Permalink
Update FluentAssertions library to latest.
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Jul 18, 2020
1 parent 8044b1a commit 2e568f6
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Source/Bogus.Tests/Bogus.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Appveyor.Testlogger" Version="2.0.0" />
<PackageReference Include="FluentAssertions" Version="4.19.4" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="morelinq" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Rant" Version="3.0.530" />
Expand Down
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/BsonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void should_be_able_to_reset_a_locale()

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

error.ShouldThrow<NullReferenceException>();
error.Should().Throw<NullReferenceException>();
}


Expand Down Expand Up @@ -135,4 +135,4 @@ private BObject CreateExtraData()
}
}

}
}
2 changes: 1 addition & 1 deletion Source/Bogus.Tests/CloneTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void can_create_a_simple_clone()

var rootOrder = orderFaker.Generate();

clonedOrder.ShouldBeEquivalentTo(rootOrder);
clonedOrder.Should().BeEquivalentTo(rootOrder);
}

[Fact]
Expand Down
3 changes: 1 addition & 2 deletions Source/Bogus.Tests/DataSetTests/CommerceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public void can_get_a_product_description()
[Fact]
public void can_get_categories()
{
commerce.Categories(3).ShouldBeEquivalentTo(
new[] {"Kids", "Music", "Jewelery"});
commerce.Categories(3).Should().BeEquivalentTo(new[] {"Kids", "Music", "Jewelery"}, opt => opt.WithStrictOrdering());
}

[Fact]
Expand Down
6 changes: 3 additions & 3 deletions Source/Bogus.Tests/DataSetTests/FinanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ public void can_generate_iban2()
public void iban_throws_key_not_found_on_invalid_iso3166()
{
Action a = () => finance.Iban(countryCode: "zz");
a.ShouldThrow<KeyNotFoundException>();
a.Should().Throw<KeyNotFoundException>();
}

[Fact]
public void iban_thows_on_invalid_iso3166_length()
{
Action a = () => finance.Iban(countryCode: "fff");
a.ShouldThrow<ArgumentOutOfRangeException>();
a.Should().Throw<ArgumentOutOfRangeException>();
}

[Fact]
Expand Down Expand Up @@ -194,4 +194,4 @@ private static bool Luhn(string digits)
).Sum() % 10 == 0;
}
}
}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/DataSetTests/InternetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void can_pick_random_browser()
foreach( var userAgent in userAgents )
{
Action act = () => req.Headers.Add("User-Agent", userAgent);
act.ShouldNotThrow();
act.Should().NotThrow();
}
}

Expand All @@ -181,4 +181,4 @@ public void can_get_username_with_unicode_characters(string first, string last,
internet.UserNameUnicode(first, last).Should().Be(expected);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void reject_registration_date_before_current_style()
var vehicle = new Vehicle();

Action a = () => vehicle.GbRegistrationPlate(new DateTime(2001, 8, 31), new DateTime(2019, 7, 5));
a.ShouldThrow<ArgumentOutOfRangeException>()
a.Should().Throw<ArgumentOutOfRangeException>()
.Where(ex => ex.Message.StartsWith("Can only accept registration dates between 2001-09-01 and 2051-02-28."))
.Where(ex => ex.ParamName == "dateFrom");
}
Expand All @@ -33,7 +33,7 @@ public void reject_registration_date_after_current_style()
{
var vehicle = new Vehicle();
Action a = () => vehicle.GbRegistrationPlate(new DateTime(2019, 7, 5), new DateTime(2051, 9, 1));
a.ShouldThrow<ArgumentOutOfRangeException>()
a.Should().Throw<ArgumentOutOfRangeException>()
.Where( ex => ex.Message.StartsWith("Can only accept registration dates between 2001-09-01 and 2051-02-28."))
.Where( ex => ex.ParamName == "dateTo" );
}
Expand Down Expand Up @@ -113,4 +113,4 @@ public void export_plates_have_pseudo_location_marker_based_on_registration_date
plate.Should().StartWith(partialPlate);
}
}
}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/FluentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void Should_Throw_Exception_If_RuleForType_Types_Dont_Match()
.RuleForType(typeof(int), f => f.Random.Word());
};

action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[Fact]
Expand Down Expand Up @@ -416,4 +416,4 @@ public void can_generate_forever()
}
}
}
}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/GitHubIssues/Issue115.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void should_throw_with_nested_expression()
Action fakerMaker = () => new Faker<Customer>()
.RuleFor(o => o.Order.Item, f => f.Random.Int(1, 1000).ToString());

fakerMaker.ShouldThrow<ArgumentException>();
fakerMaker.Should().Throw<ArgumentException>();

}

Expand Down Expand Up @@ -62,4 +62,4 @@ public void calling_finish_with_twice_is_okay()
console.Dump(order);
}
}
}
}
10 changes: 5 additions & 5 deletions Source/Bogus.Tests/GitHubIssues/Issue132.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ public class Issue132 : SeededTest
public void should_throw_exception_on_invalid_locale_dataset()
{
Action a = () => new Lorem("wtf_locale");
a.ShouldThrow<BogusException>();
a.Should().Throw<BogusException>();
}

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

a.ShouldThrow<BogusException>();
a.Should().Throw<BogusException>();
}

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

a.ShouldThrow<BogusException>();
a.Should().Throw<BogusException>();
}

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

a.ShouldThrow<BogusException>()
a.Should().Throw<BogusException>()
.And.Message
.Should().Contain("https://github.com/bchavez/Bogus");

Expand Down Expand Up @@ -166,4 +166,4 @@ public void de_locale()
.Should().Be("de");
}
}
}
}
8 changes: 4 additions & 4 deletions Source/Bogus.Tests/GitHubIssues/Issue218.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void global_strict_mode_should_throw_on_incomplete_rules()

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

gen.ShouldThrow<ValidationException>();
gen.Should().Throw<ValidationException>();

Faker.DefaultStrictMode = false;
}
Expand All @@ -33,7 +33,7 @@ public void local_struct_mode_faker_t_scope_should_throw_on_incomplete_rules()

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

gen.ShouldThrow<ValidationException>();
gen.Should().Throw<ValidationException>();
}


Expand All @@ -48,9 +48,9 @@ public void local_strict_mode_should_take_precedence_always()

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

gen.ShouldNotThrow<ValidationException>();
gen.Should().NotThrow<ValidationException>();

Faker.DefaultStrictMode = false;
}
}
}
}
6 changes: 3 additions & 3 deletions Source/Bogus.Tests/GitHubIssues/Issue253.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void rulefor_a_field_that_doesnt_exist_throws()

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

act.ShouldThrow<ArgumentException>();
act.Should().Throw<ArgumentException>();
}

[Fact]
Expand All @@ -54,7 +54,7 @@ public void ignoring_a_field_that_doesnt_exist_throws()

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

act.ShouldThrow<ArgumentException>();
act.Should().Throw<ArgumentException>();
}

[Fact]
Expand All @@ -72,4 +72,4 @@ public void should_be_able_to_use_rulefor_with_typeT()
order.Item.Should().Be("0Computer");
}
}
}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/GitHubIssues/Issue255.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void explicit_interface_properties_in_child_interfaces_should_throw_when_
.RuleFor(e => e.City, f => f.Address.City());

Action act = () => childFaker.AssertConfigurationIsValid();
act.ShouldThrow<ValidationException>();
act.Should().Throw<ValidationException>();
}

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

Action act = () => childFaker.AssertConfigurationIsValid();
act.ShouldThrow<ValidationException>();
act.Should().Throw<ValidationException>();
}

public class ChildWithNormalInterface : IChild
Expand Down
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/GitHubIssues/Issue279.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void redefine_ordering_other_than_initial_order_of_faker_t_rules_throws_b
//defined order.
Action generate = () => barFaker.Generate();

generate.ShouldThrow<NullReferenceException>();
generate.Should().Throw<NullReferenceException>();
}

[Fact]
Expand Down Expand Up @@ -289,4 +289,4 @@ public static MultiDictionary<T, U, V> Clone<T, U, V>(this MultiDictionary<T, U,
}
}

}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/GitHubIssues/Issue280.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void automatic_type_conversion_fails_by_default()

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

generate.ShouldThrow<ArgumentException>();
generate.Should().Throw<ArgumentException>();
}

[Fact]
Expand Down Expand Up @@ -91,4 +91,4 @@ private object ConvertValue(string propertyOrField, object initialValue)
}
}
}
}
}
2 changes: 1 addition & 1 deletion Source/Bogus.Tests/GitHubIssues/Issue309.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void ruleforlist_addrange()

console.Dump(user);
user.Hobbies.Should().HaveCount(3);
user.Hobbies.ShouldAllBeEquivalentTo(expected, opt => opt.WithStrictOrdering());
user.Hobbies.Should().BeEquivalentTo(expected, opt => opt.WithStrictOrdering());
}

public class Hobby
Expand Down
6 changes: 3 additions & 3 deletions Source/Bogus.Tests/GitHubIssues/Issue49.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public void issue_49_pr_51_pick_random_subset()

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

bounds1.ShouldThrow<ArgumentOutOfRangeException>();
bounds1.Should().Throw<ArgumentOutOfRangeException>();

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

bounds2.ShouldThrow<ArgumentOutOfRangeException>();
bounds2.Should().Throw<ArgumentOutOfRangeException>();

var picked = f.PickRandom(items, 4).ToArray();
picked.Dump();
picked.Should().Equal(7, 2, 9, 8);
}
}
}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/GitHubIssues/PullRequest149.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public void ensure_arabic_locale_exists()
{
Action a = () => new Faker("ar");

a.ShouldNotThrow();
a.Should().NotThrow();
}
}
}
}
4 changes: 2 additions & 2 deletions Source/Bogus.Tests/HandlebarsTests/ArgumentsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void unmached_brace_should_throw()
var faker = new Faker();
//easy to miss the closing ) with }} handle bars.
Action a = () => faker.Parse("{{randomizer.number(100 }}");
a.ShouldThrow<ArgumentException>();
a.Should().Throw<ArgumentException>();
}

[Fact]
Expand All @@ -138,4 +138,4 @@ public void can_parse_timespan_with_arguments()
.Should().Be("00:00:15.0880571");
}
}
}
}
2 changes: 1 addition & 1 deletion Source/Bogus.Tests/PersonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void can_use_local_seed_for_person()
p1.Gender.Should().Be(p2.Gender);
p1.Website.Should().Be(p2.Website);

p1.ShouldBeEquivalentTo(p2);
p1.Should().BeEquivalentTo(p2);

Date.SystemClock = () => DateTime.Now;
}
Expand Down
Loading

0 comments on commit 2e568f6

Please sign in to comment.