Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 8e73411

Browse files
[v2] Replace FluentAssertions with Shouldly
`Shouldly` does not have an extension for `ShouldBeFalse` or `ShouldBeTrue`, which accepts `bool?`, yet.
1 parent 4d313b7 commit 8e73411

File tree

231 files changed

+8124
-7828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+8124
-7828
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<ItemGroup>
1818
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
1919
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
20-
<PackageVersion Include="FluentAssertions" Version="8.0.1" />
2120
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
2221
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.0.0" />
22+
<PackageVersion Include="Shouldly" Version="4.3.0" />
2323
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
2424
<PackageVersion Include="xunit" Version="2.9.3" />
2525
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.1" />

src/tests/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup Condition="'$(IsTestProject)' == 'true' AND '$(IsTestUtilityProject)' != 'true'">
12-
<PackageReference Include="FluentAssertions" />
12+
<PackageReference Include="Shouldly" />
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1414
<PackageReference Include="xunit" />
1515

src/tests/libs/Trakt.NET.Core.Tests/Contexts/TraktContextTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,52 @@ public void TestTraktContextWithClientIDAndSecret()
1010
{
1111
var context = new TraktDefaultContext(ClientID, ClientSecret);
1212

13-
context.ID.Should().NotBeNullOrEmpty();
14-
context.ClientID.Should().Be(ClientID);
15-
context.ClientSecret.Should().Be(ClientSecret);
16-
context.Authorization.Should().BeNull();
13+
context.ID.ShouldNotBeNullOrEmpty();
14+
context.ClientID.ShouldBe(ClientID);
15+
context.ClientSecret.ShouldBe(ClientSecret);
16+
context.Authorization.ShouldBeNull();
1717
}
1818

1919
[Fact]
2020
public void TestTraktContextHasCorrectBaseUri()
2121
{
2222
var context = new TraktDefaultContext(ClientID, ClientSecret);
2323

24-
context.BaseUri.AbsoluteUri.Should().Be("https://api.trakt.tv/");
24+
context.BaseUri.AbsoluteUri.ShouldBe("https://api.trakt.tv/");
2525
}
2626

2727
[Fact]
2828
public void TestTraktContextHasCorrectBaseAuthorizationUri()
2929
{
3030
var context = new TraktDefaultContext(ClientID, ClientSecret);
3131

32-
context.BaseAuthorizationUri.AbsoluteUri.Should().Be("https://trakt.tv/");
32+
context.BaseAuthorizationUri.AbsoluteUri.ShouldBe("https://trakt.tv/");
3333
}
3434

3535
[Fact]
3636
public void TestTraktContextInvalidClientID()
3737
{
3838
Action act = () => _ = new TraktDefaultContext(string.Empty, ClientSecret);
39-
act.Should().Throw<ArgumentException>();
39+
act.ShouldThrow<ArgumentException>();
4040

4141
act = () => _ = new TraktDefaultContext(" ", ClientSecret);
42-
act.Should().Throw<ArgumentException>();
42+
act.ShouldThrow<ArgumentException>();
4343

4444
act = () => _ = new TraktDefaultContext(" id ", ClientSecret);
45-
act.Should().Throw<ArgumentException>();
45+
act.ShouldThrow<ArgumentException>();
4646
}
4747

4848
[Fact]
4949
public void TestTraktContextInvalidClientSecret()
5050
{
5151
Action act = () => _ = new TraktDefaultContext(ClientID, string.Empty);
52-
act.Should().Throw<ArgumentException>();
52+
act.ShouldThrow<ArgumentException>();
5353

5454
act = () => _ = new TraktDefaultContext(ClientID, " ");
55-
act.Should().Throw<ArgumentException>();
55+
act.ShouldThrow<ArgumentException>();
5656

5757
act = () => _ = new TraktDefaultContext(ClientID, " secret ");
58-
act.Should().Throw<ArgumentException>();
58+
act.ShouldThrow<ArgumentException>();
5959
}
6060
}
6161
}

src/tests/libs/Trakt.NET.Core.Tests/Contexts/TraktSandboxContextTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,52 @@ public void TestTraktSandboxContextWithClientIDAndSecret()
1010
{
1111
var context = new TraktSandboxContext(ClientID, ClientSecret);
1212

13-
context.ID.Should().NotBeNullOrEmpty();
14-
context.ClientID.Should().Be(ClientID);
15-
context.ClientSecret.Should().Be(ClientSecret);
16-
context.Authorization.Should().BeNull();
13+
context.ID.ShouldNotBeNullOrEmpty();
14+
context.ClientID.ShouldBe(ClientID);
15+
context.ClientSecret.ShouldBe(ClientSecret);
16+
context.Authorization.ShouldBeNull();
1717
}
1818

1919
[Fact]
2020
public void TestTraktSandboxContextHasCorrectBaseUri()
2121
{
2222
var context = new TraktSandboxContext(ClientID, ClientSecret);
2323

24-
context.BaseUri.AbsoluteUri.Should().Be("https://api-staging.trakt.tv/");
24+
context.BaseUri.AbsoluteUri.ShouldBe("https://api-staging.trakt.tv/");
2525
}
2626

2727
[Fact]
2828
public void TestTraktSandboxContextHasCorrectBaseAuthorizationUri()
2929
{
3030
var context = new TraktSandboxContext(ClientID, ClientSecret);
3131

32-
context.BaseAuthorizationUri.AbsoluteUri.Should().Be("https://staging.trakt.tv/");
32+
context.BaseAuthorizationUri.AbsoluteUri.ShouldBe("https://staging.trakt.tv/");
3333
}
3434

3535
[Fact]
3636
public void TestTraktSandboxContextInvalidClientID()
3737
{
3838
Action act = () => _ = new TraktSandboxContext(string.Empty, ClientSecret);
39-
act.Should().Throw<ArgumentException>();
39+
act.ShouldThrow<ArgumentException>();
4040

4141
act = () => _ = new TraktSandboxContext(" ", ClientSecret);
42-
act.Should().Throw<ArgumentException>();
42+
act.ShouldThrow<ArgumentException>();
4343

4444
act = () => _ = new TraktSandboxContext(" id ", ClientSecret);
45-
act.Should().Throw<ArgumentException>();
45+
act.ShouldThrow<ArgumentException>();
4646
}
4747

4848
[Fact]
4949
public void TestTraktSandboxContextInvalidClientSecret()
5050
{
5151
Action act = () => _ = new TraktSandboxContext(ClientID, string.Empty);
52-
act.Should().Throw<ArgumentException>();
52+
act.ShouldThrow<ArgumentException>();
5353

5454
act = () => _ = new TraktSandboxContext(ClientID, " ");
55-
act.Should().Throw<ArgumentException>();
55+
act.ShouldThrow<ArgumentException>();
5656

5757
act = () => _ = new TraktSandboxContext(ClientID, " secret ");
58-
act.Should().Throw<ArgumentException>();
58+
act.ShouldThrow<ArgumentException>();
5959
}
6060
}
6161
}

src/tests/libs/Trakt.NET.Core.Tests/Enums/TraktAccessScopeTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ public sealed class TraktAccessScopeTests
55
[Fact]
66
public void TestTraktAccessScopeToJson()
77
{
8-
TraktAccessScope.Unspecified.ToJson().Should().BeNull();
9-
TraktAccessScope.Private.ToJson().Should().Be("private");
10-
TraktAccessScope.Friends.ToJson().Should().Be("friends");
11-
TraktAccessScope.Public.ToJson().Should().Be("public");
8+
TraktAccessScope.Unspecified.ToJson().ShouldBeNull();
9+
TraktAccessScope.Private.ToJson().ShouldBe("private");
10+
TraktAccessScope.Friends.ToJson().ShouldBe("friends");
11+
TraktAccessScope.Public.ToJson().ShouldBe("public");
1212
}
1313

1414
[Fact]
1515
public void TestTraktAccessScopeFromJson()
1616
{
17-
"unspecified".ToTraktAccessScope().Should().Be(TraktAccessScope.Unspecified);
18-
"private".ToTraktAccessScope().Should().Be(TraktAccessScope.Private);
19-
"friends".ToTraktAccessScope().Should().Be(TraktAccessScope.Friends);
20-
"public".ToTraktAccessScope().Should().Be(TraktAccessScope.Public);
17+
"unspecified".ToTraktAccessScope().ShouldBe(TraktAccessScope.Unspecified);
18+
"private".ToTraktAccessScope().ShouldBe(TraktAccessScope.Private);
19+
"friends".ToTraktAccessScope().ShouldBe(TraktAccessScope.Friends);
20+
"public".ToTraktAccessScope().ShouldBe(TraktAccessScope.Public);
2121

2222
string? nullValue = null;
23-
nullValue.ToTraktAccessScope().Should().Be(TraktAccessScope.Unspecified);
23+
nullValue.ToTraktAccessScope().ShouldBe(TraktAccessScope.Unspecified);
2424
}
2525

2626
[Fact]
2727
public void TestTraktAccessScopeDisplayName()
2828
{
29-
TraktAccessScope.Unspecified.DisplayName().Should().Be("Unspecified");
30-
TraktAccessScope.Private.DisplayName().Should().Be("Private");
31-
TraktAccessScope.Friends.DisplayName().Should().Be("Friends");
32-
TraktAccessScope.Public.DisplayName().Should().Be("Public");
29+
TraktAccessScope.Unspecified.DisplayName().ShouldBe("Unspecified");
30+
TraktAccessScope.Private.DisplayName().ShouldBe("Private");
31+
TraktAccessScope.Friends.DisplayName().ShouldBe("Friends");
32+
TraktAccessScope.Public.DisplayName().ShouldBe("Public");
3333
}
3434
}
3535
}

src/tests/libs/Trakt.NET.Core.Tests/Enums/TraktAccessTokenGrantTypeTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ public sealed class TraktAccessTokenGrantTypeTests
55
[Fact]
66
public void TestTraktAccessTokenGrantTypeToJson()
77
{
8-
TraktAccessTokenGrantType.Unspecified.ToJson().Should().BeNull();
9-
TraktAccessTokenGrantType.AuthorizationCode.ToJson().Should().Be("authorization_code");
10-
TraktAccessTokenGrantType.RefreshToken.ToJson().Should().Be("refresh_token");
8+
TraktAccessTokenGrantType.Unspecified.ToJson().ShouldBeNull();
9+
TraktAccessTokenGrantType.AuthorizationCode.ToJson().ShouldBe("authorization_code");
10+
TraktAccessTokenGrantType.RefreshToken.ToJson().ShouldBe("refresh_token");
1111
}
1212

1313
[Fact]
1414
public void TestTraktAccessTokenGrantTypeFromJson()
1515
{
16-
"unspecified".ToTraktAccessTokenGrantType().Should().Be(TraktAccessTokenGrantType.Unspecified);
17-
"authorization_code".ToTraktAccessTokenGrantType().Should().Be(TraktAccessTokenGrantType.AuthorizationCode);
18-
"refresh_token".ToTraktAccessTokenGrantType().Should().Be(TraktAccessTokenGrantType.RefreshToken);
16+
"unspecified".ToTraktAccessTokenGrantType().ShouldBe(TraktAccessTokenGrantType.Unspecified);
17+
"authorization_code".ToTraktAccessTokenGrantType().ShouldBe(TraktAccessTokenGrantType.AuthorizationCode);
18+
"refresh_token".ToTraktAccessTokenGrantType().ShouldBe(TraktAccessTokenGrantType.RefreshToken);
1919

2020
string? nullValue = null;
21-
nullValue.ToTraktAccessTokenGrantType().Should().Be(TraktAccessTokenGrantType.Unspecified);
21+
nullValue.ToTraktAccessTokenGrantType().ShouldBe(TraktAccessTokenGrantType.Unspecified);
2222
}
2323

2424
[Fact]
2525
public void TestTraktAccessTokenGrantTypeDisplayName()
2626
{
27-
TraktAccessTokenGrantType.Unspecified.DisplayName().Should().Be("Unspecified");
28-
TraktAccessTokenGrantType.AuthorizationCode.DisplayName().Should().Be("Authorization Code");
29-
TraktAccessTokenGrantType.RefreshToken.DisplayName().Should().Be("Refresh Token");
27+
TraktAccessTokenGrantType.Unspecified.DisplayName().ShouldBe("Unspecified");
28+
TraktAccessTokenGrantType.AuthorizationCode.DisplayName().ShouldBe("Authorization Code");
29+
TraktAccessTokenGrantType.RefreshToken.DisplayName().ShouldBe("Refresh Token");
3030
}
3131
}
3232
}

src/tests/libs/Trakt.NET.Core.Tests/Enums/TraktAccessTokenTypeTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ public sealed class TraktAccessTokenTypeTests
55
[Fact]
66
public void TestTraktAccessTokenTypeToJson()
77
{
8-
TraktAccessTokenType.Unspecified.ToJson().Should().BeNull();
9-
TraktAccessTokenType.Bearer.ToJson().Should().Be("bearer");
8+
TraktAccessTokenType.Unspecified.ToJson().ShouldBeNull();
9+
TraktAccessTokenType.Bearer.ToJson().ShouldBe("bearer");
1010
}
1111

1212
[Fact]
1313
public void TestTraktAccessTokenTypeFromJson()
1414
{
15-
"unspecified".ToTraktAccessTokenType().Should().Be(TraktAccessTokenType.Unspecified);
16-
"bearer".ToTraktAccessTokenType().Should().Be(TraktAccessTokenType.Bearer);
15+
"unspecified".ToTraktAccessTokenType().ShouldBe(TraktAccessTokenType.Unspecified);
16+
"bearer".ToTraktAccessTokenType().ShouldBe(TraktAccessTokenType.Bearer);
1717

1818
string? nullValue = null;
19-
nullValue.ToTraktAccessTokenType().Should().Be(TraktAccessTokenType.Unspecified);
19+
nullValue.ToTraktAccessTokenType().ShouldBe(TraktAccessTokenType.Unspecified);
2020
}
2121

2222
[Fact]
2323
public void TestTraktAccessTokenTypeDisplayName()
2424
{
25-
TraktAccessTokenType.Unspecified.DisplayName().Should().Be("Unspecified");
26-
TraktAccessTokenType.Bearer.DisplayName().Should().Be("Bearer");
25+
TraktAccessTokenType.Unspecified.DisplayName().ShouldBe("Unspecified");
26+
TraktAccessTokenType.Bearer.DisplayName().ShouldBe("Bearer");
2727
}
2828
}
2929
}

src/tests/libs/Trakt.NET.Core.Tests/Enums/TraktCommentObjectTypeTests.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,40 @@ public sealed class TraktCommentObjectTypeTests
55
[Fact]
66
public void TestTraktCommentObjectTypeToJson()
77
{
8-
TraktCommentObjectType.Unspecified.ToJson().Should().BeNull();
9-
TraktCommentObjectType.Movie.ToJson().Should().Be("movie");
10-
TraktCommentObjectType.Show.ToJson().Should().Be("show");
11-
TraktCommentObjectType.Season.ToJson().Should().Be("season");
12-
TraktCommentObjectType.Episode.ToJson().Should().Be("episode");
13-
TraktCommentObjectType.List.ToJson().Should().Be("list");
14-
TraktCommentObjectType.All.ToJson().Should().Be("all");
8+
TraktCommentObjectType.Unspecified.ToJson().ShouldBeNull();
9+
TraktCommentObjectType.Movie.ToJson().ShouldBe("movie");
10+
TraktCommentObjectType.Show.ToJson().ShouldBe("show");
11+
TraktCommentObjectType.Season.ToJson().ShouldBe("season");
12+
TraktCommentObjectType.Episode.ToJson().ShouldBe("episode");
13+
TraktCommentObjectType.List.ToJson().ShouldBe("list");
14+
TraktCommentObjectType.All.ToJson().ShouldBe("all");
1515
}
1616

1717
[Fact]
1818
public void TestTraktCommentObjectTypeFromJson()
1919
{
20-
"unspecified".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.Unspecified);
21-
"movie".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.Movie);
22-
"show".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.Show);
23-
"season".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.Season);
24-
"episode".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.Episode);
25-
"list".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.List);
26-
"all".ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.All);
20+
"unspecified".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.Unspecified);
21+
"movie".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.Movie);
22+
"show".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.Show);
23+
"season".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.Season);
24+
"episode".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.Episode);
25+
"list".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.List);
26+
"all".ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.All);
2727

2828
string? nullValue = null;
29-
nullValue.ToTraktCommentObjectType().Should().Be(TraktCommentObjectType.Unspecified);
29+
nullValue.ToTraktCommentObjectType().ShouldBe(TraktCommentObjectType.Unspecified);
3030
}
3131

3232
[Fact]
3333
public void TestTraktCommentObjectTypeDisplayName()
3434
{
35-
TraktCommentObjectType.Unspecified.DisplayName().Should().Be("Unspecified");
36-
TraktCommentObjectType.Movie.DisplayName().Should().Be("Movie");
37-
TraktCommentObjectType.Show.DisplayName().Should().Be("Show");
38-
TraktCommentObjectType.Season.DisplayName().Should().Be("Season");
39-
TraktCommentObjectType.Episode.DisplayName().Should().Be("Episode");
40-
TraktCommentObjectType.List.DisplayName().Should().Be("List");
41-
TraktCommentObjectType.All.DisplayName().Should().Be("All");
35+
TraktCommentObjectType.Unspecified.DisplayName().ShouldBe("Unspecified");
36+
TraktCommentObjectType.Movie.DisplayName().ShouldBe("Movie");
37+
TraktCommentObjectType.Show.DisplayName().ShouldBe("Show");
38+
TraktCommentObjectType.Season.DisplayName().ShouldBe("Season");
39+
TraktCommentObjectType.Episode.DisplayName().ShouldBe("Episode");
40+
TraktCommentObjectType.List.DisplayName().ShouldBe("List");
41+
TraktCommentObjectType.All.DisplayName().ShouldBe("All");
4242
}
4343
}
4444
}

0 commit comments

Comments
 (0)