Skip to content

Commit 58f6d09

Browse files
committed
Replace FluentAssertions with Shouldly
Migrate the test assertion library from FluentAssertions to Shouldly across both test projects. All 455 tests pass after migration. Fixes #134
1 parent 9d7becb commit 58f6d09

41 files changed

Lines changed: 667 additions & 687 deletions

File tree

Some content is hidden

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

tests/Atypical.VirtualFileSystem.GitHub.Tests/Atypical.VirtualFileSystem.GitHub.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FluentAssertions" Version="8.8.0" />
9+
<PackageReference Include="Shouldly" Version="4.3.0" />
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
1111
<PackageReference Include="NSubstitute" Version="5.3.0" />
1212
<PackageReference Include="xunit" Version="2.9.3" />

tests/Atypical.VirtualFileSystem.GitHub.Tests/GitHubLoadResultTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void FullRepositoryName_ShouldCombineOwnerAndRepo()
1515
var result = CreateTestResult();
1616

1717
// Act & Assert
18-
result.FullRepositoryName.Should().Be("testowner/testrepo");
18+
result.FullRepositoryName.ShouldBe("testowner/testrepo");
1919
}
2020

2121
[Fact]
@@ -30,7 +30,7 @@ public void FilesSkipped_ShouldReturnCountOfSkippedFiles()
3030
var result = CreateTestResult(skippedFiles: skippedFiles);
3131

3232
// Act & Assert
33-
result.FilesSkipped.Should().Be(2);
33+
result.FilesSkipped.ShouldBe(2);
3434
}
3535

3636
[Fact]
@@ -44,7 +44,7 @@ public void HasSkippedFiles_ShouldReturnTrueWhenFilesSkipped()
4444
var result = CreateTestResult(skippedFiles: skippedFiles);
4545

4646
// Act & Assert
47-
result.HasSkippedFiles.Should().BeTrue();
47+
result.HasSkippedFiles.ShouldBeTrue();
4848
}
4949

5050
[Fact]
@@ -54,7 +54,7 @@ public void HasSkippedFiles_ShouldReturnFalseWhenNoFilesSkipped()
5454
var result = CreateTestResult();
5555

5656
// Act & Assert
57-
result.HasSkippedFiles.Should().BeFalse();
57+
result.HasSkippedFiles.ShouldBeFalse();
5858
}
5959

6060
[Theory]
@@ -73,7 +73,7 @@ public void Summary_ShouldContainFormattedSize(long bytes, string expectedSize)
7373
var summary = result.Summary;
7474

7575
// Assert
76-
summary.Should().Contain(expectedSize);
76+
summary.ShouldContain(expectedSize);
7777
}
7878

7979
[Fact]
@@ -92,7 +92,7 @@ public void Summary_ShouldIncludeSkippedFilesCount()
9292
var summary = result.Summary;
9393

9494
// Assert
95-
summary.Should().Contain("3 files skipped");
95+
summary.ShouldContain("3 files skipped");
9696
}
9797

9898
[Fact]
@@ -112,10 +112,10 @@ public void SkippedFilesByReason_ShouldGroupCorrectly()
112112
var byReason = result.SkippedFilesByReason;
113113

114114
// Assert
115-
byReason.Should().ContainKey(SkipReason.TooLarge);
116-
byReason[SkipReason.TooLarge].Should().HaveCount(2);
117-
byReason[SkipReason.BinaryExcluded].Should().HaveCount(1);
118-
byReason[SkipReason.ExtensionExcluded].Should().HaveCount(1);
115+
byReason.ShouldContainKey(SkipReason.TooLarge);
116+
byReason[SkipReason.TooLarge].Count.ShouldBe(2);
117+
byReason[SkipReason.BinaryExcluded].Count.ShouldBe(1);
118+
byReason[SkipReason.ExtensionExcluded].Count.ShouldBe(1);
119119
}
120120

121121
private static GitHubLoadResult CreateTestResult(

tests/Atypical.VirtualFileSystem.GitHub.Tests/GitHubLoaderOptionsTests.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ public void Default_ShouldHaveExpectedValues()
1515
var options = GitHubLoaderOptions.Default;
1616

1717
// Assert
18-
options.AccessToken.Should().BeNull();
19-
options.Branch.Should().BeNull();
20-
options.SubPath.Should().BeNull();
21-
options.TargetPath.Should().Be("/");
22-
options.MaxFileSize.Should().Be(1_048_576);
23-
options.IncludeExtensions.Should().BeNull();
24-
options.ExcludeExtensions.Should().BeNull();
25-
options.ExcludePatterns.Should().BeNull();
26-
options.IncludeBinaryFiles.Should().BeTrue();
27-
options.Strategy.Should().Be(GitHubLoadingStrategy.Eager);
28-
options.ProgressCallback.Should().BeNull();
18+
options.AccessToken.ShouldBeNull();
19+
options.Branch.ShouldBeNull();
20+
options.SubPath.ShouldBeNull();
21+
options.TargetPath.ShouldBe("/");
22+
options.MaxFileSize.ShouldBe(1_048_576);
23+
options.IncludeExtensions.ShouldBeNull();
24+
options.ExcludeExtensions.ShouldBeNull();
25+
options.ExcludePatterns.ShouldBeNull();
26+
options.IncludeBinaryFiles.ShouldBeTrue();
27+
options.Strategy.ShouldBe(GitHubLoadingStrategy.Eager);
28+
options.ProgressCallback.ShouldBeNull();
2929
}
3030

3131
[Fact]
@@ -35,11 +35,11 @@ public void SourceCodeOnly_ShouldExcludeBinaryFilesAndCommonDirectories()
3535
var options = GitHubLoaderOptions.SourceCodeOnly;
3636

3737
// Assert
38-
options.IncludeBinaryFiles.Should().BeFalse();
39-
options.ExcludePatterns.Should().NotBeNull();
40-
options.ExcludePatterns.Should().Contain("**/node_modules/**");
41-
options.ExcludePatterns.Should().Contain("**/bin/**");
42-
options.ExcludePatterns.Should().Contain("**/obj/**");
38+
options.IncludeBinaryFiles.ShouldBeFalse();
39+
options.ExcludePatterns.ShouldNotBeNull();
40+
options.ExcludePatterns.ShouldContain("**/node_modules/**");
41+
options.ExcludePatterns.ShouldContain("**/bin/**");
42+
options.ExcludePatterns.ShouldContain("**/obj/**");
4343
}
4444

4545
[Fact]
@@ -49,13 +49,13 @@ public void CSharpOnly_ShouldIncludeOnlyCSharpExtensions()
4949
var options = GitHubLoaderOptions.CSharpOnly;
5050

5151
// Assert
52-
options.IncludeBinaryFiles.Should().BeFalse();
53-
options.IncludeExtensions.Should().NotBeNull();
54-
options.IncludeExtensions.Should().Contain(".cs");
55-
options.IncludeExtensions.Should().Contain(".csproj");
56-
options.IncludeExtensions.Should().Contain(".sln");
57-
options.ExcludePatterns.Should().Contain("**/bin/**");
58-
options.ExcludePatterns.Should().Contain("**/obj/**");
52+
options.IncludeBinaryFiles.ShouldBeFalse();
53+
options.IncludeExtensions.ShouldNotBeNull();
54+
options.IncludeExtensions.ShouldContain(".cs");
55+
options.IncludeExtensions.ShouldContain(".csproj");
56+
options.IncludeExtensions.ShouldContain(".sln");
57+
options.ExcludePatterns.ShouldContain("**/bin/**");
58+
options.ExcludePatterns.ShouldContain("**/obj/**");
5959
}
6060

6161
[Fact]
@@ -65,7 +65,7 @@ public void MetadataOnlyPreset_ShouldUseMetadataOnlyStrategy()
6565
var options = GitHubLoaderOptions.MetadataOnlyPreset;
6666

6767
// Assert
68-
options.Strategy.Should().Be(GitHubLoadingStrategy.MetadataOnly);
68+
options.Strategy.ShouldBe(GitHubLoadingStrategy.MetadataOnly);
6969
}
7070

7171
[Theory]
@@ -87,7 +87,7 @@ public void IsBinaryExtension_ShouldCorrectlyIdentifyBinaryExtensions(string ext
8787
var result = GitHubLoaderOptions.IsBinaryExtension(extension);
8888

8989
// Assert
90-
result.Should().Be(expected);
90+
result.ShouldBe(expected);
9191
}
9292

9393
[Theory]
@@ -100,7 +100,7 @@ public void IsBinaryExtension_ShouldBeCaseInsensitive(string extension, bool exp
100100
var result = GitHubLoaderOptions.IsBinaryExtension(extension);
101101

102102
// Assert
103-
result.Should().Be(expected);
103+
result.ShouldBe(expected);
104104
}
105105

106106
[Fact]
@@ -113,9 +113,9 @@ public void WithRecord_ShouldCreateNewInstanceWithModifiedProperty()
113113
var modified = original with { AccessToken = "test-token" };
114114

115115
// Assert
116-
original.AccessToken.Should().BeNull();
117-
modified.AccessToken.Should().Be("test-token");
118-
modified.MaxFileSize.Should().Be(original.MaxFileSize);
116+
original.AccessToken.ShouldBeNull();
117+
modified.AccessToken.ShouldBe("test-token");
118+
modified.MaxFileSize.ShouldBe(original.MaxFileSize);
119119
}
120120

121121
[Fact]
@@ -131,9 +131,9 @@ public void WithRecord_ShouldSupportMultipleModifications()
131131
};
132132

133133
// Assert
134-
options.AccessToken.Should().Be("my-token");
135-
options.Branch.Should().Be("develop");
136-
options.MaxFileSize.Should().Be(5_000_000);
137-
options.Strategy.Should().Be(GitHubLoadingStrategy.Lazy);
134+
options.AccessToken.ShouldBe("my-token");
135+
options.Branch.ShouldBe("develop");
136+
options.MaxFileSize.ShouldBe(5_000_000);
137+
options.Strategy.ShouldBe(GitHubLoadingStrategy.Lazy);
138138
}
139139
}

tests/Atypical.VirtualFileSystem.GitHub.Tests/GitHubRepositoryLoaderTests.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public void TryParseGitHubUrl_WithValidUrls_ShouldReturnTrue(string url, string
3232
var result = _loader.TryParseGitHubUrl(url, out var owner, out var repo);
3333

3434
// Assert
35-
result.Should().BeTrue();
36-
owner.Should().Be(expectedOwner);
37-
repo.Should().Be(expectedRepo);
35+
result.ShouldBeTrue();
36+
owner.ShouldBe(expectedOwner);
37+
repo.ShouldBe(expectedRepo);
3838
}
3939

4040
[Theory]
@@ -52,25 +52,25 @@ public void TryParseGitHubUrl_WithInvalidUrls_ShouldReturnFalse(string? url)
5252
var result = _loader.TryParseGitHubUrl(url!, out var owner, out var repo);
5353

5454
// Assert
55-
result.Should().BeFalse();
56-
owner.Should().BeEmpty();
57-
repo.Should().BeEmpty();
55+
result.ShouldBeFalse();
56+
owner.ShouldBeEmpty();
57+
repo.ShouldBeEmpty();
5858
}
5959

6060
[Fact]
6161
public void Constructor_WithDefaultOptions_ShouldNotThrow()
6262
{
6363
// Act & Assert
6464
var action = () => new GitHubRepositoryLoader();
65-
action.Should().NotThrow();
65+
action.ShouldNotThrow();
6666
}
6767

6868
[Fact]
6969
public void Constructor_WithAccessToken_ShouldNotThrow()
7070
{
7171
// Act & Assert
7272
var action = () => new GitHubRepositoryLoader("test-token");
73-
action.Should().NotThrow();
73+
action.ShouldNotThrow();
7474
}
7575

7676
[Fact]
@@ -84,7 +84,7 @@ public void Constructor_WithOptions_ShouldNotThrow()
8484

8585
// Act & Assert
8686
var action = () => new GitHubRepositoryLoader(options);
87-
action.Should().NotThrow();
87+
action.ShouldNotThrow();
8888
}
8989

9090
[Fact]
@@ -94,8 +94,8 @@ public async Task LoadRepositoryAsync_WithNullVfs_ShouldThrowArgumentNullExcepti
9494
var action = () => _loader.LoadRepositoryAsync(null!, "owner", "repo");
9595

9696
// Assert
97-
await action.Should().ThrowAsync<ArgumentNullException>()
98-
.WithParameterName("vfs");
97+
var ex = await Should.ThrowAsync<ArgumentNullException>(action);
98+
ex.ParamName.ShouldBe("vfs");
9999
}
100100

101101
[Theory]
@@ -111,8 +111,8 @@ public async Task LoadRepositoryAsync_WithInvalidOwner_ShouldThrowArgumentExcept
111111
var action = () => _loader.LoadRepositoryAsync(vfs, owner!, "repo");
112112

113113
// Assert
114-
await action.Should().ThrowAsync<ArgumentException>()
115-
.WithParameterName("owner");
114+
var ex = await Should.ThrowAsync<ArgumentException>(action);
115+
ex.ParamName.ShouldBe("owner");
116116
}
117117

118118
[Theory]
@@ -128,8 +128,8 @@ public async Task LoadRepositoryAsync_WithInvalidRepository_ShouldThrowArgumentE
128128
var action = () => _loader.LoadRepositoryAsync(vfs, "owner", repository!);
129129

130130
// Assert
131-
await action.Should().ThrowAsync<ArgumentException>()
132-
.WithParameterName("repository");
131+
var ex = await Should.ThrowAsync<ArgumentException>(action);
132+
ex.ParamName.ShouldBe("repository");
133133
}
134134

135135
[Fact]
@@ -142,8 +142,8 @@ public async Task LoadRepositoryFromUrlAsync_WithInvalidUrl_ShouldThrowArgumentE
142142
var action = () => _loader.LoadRepositoryFromUrlAsync(vfs, "not-a-valid-url");
143143

144144
// Assert
145-
await action.Should().ThrowAsync<ArgumentException>()
146-
.WithParameterName("repositoryUrl");
145+
var ex = await Should.ThrowAsync<ArgumentException>(action);
146+
ex.ParamName.ShouldBe("repositoryUrl");
147147
}
148148

149149
[Fact]
@@ -159,7 +159,7 @@ public async Task TryLoadRepositoryAsync_WithNonExistentRepo_ShouldReturnFalse()
159159
"non-existent-repo-67890");
160160

161161
// Assert
162-
success.Should().BeFalse();
163-
result.Should().BeNull();
162+
success.ShouldBeFalse();
163+
result.ShouldBeNull();
164164
}
165165
}

tests/Atypical.VirtualFileSystem.GitHub.Tests/GlobalUsings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// LICENSE file in the root directory of this source tree.
66

77
global using Xunit;
8-
global using FluentAssertions;
8+
global using Shouldly;
99
global using NSubstitute;
1010
global using Atypical.VirtualFileSystem.Core;
1111
global using Atypical.VirtualFileSystem.Core.Contracts;

tests/Atypical.VirtualFileSystem.GitHub.Tests/VFSGitHubExtensionsTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public void TryParseGitHubUrl_WithValidUrls_ShouldParse(string url, string expec
1818
var result = VFSGitHubExtensions.TryParseGitHubUrl(url, out var owner, out var repo);
1919

2020
// Assert
21-
result.Should().BeTrue();
22-
owner.Should().Be(expectedOwner);
23-
repo.Should().Be(expectedRepo);
21+
result.ShouldBeTrue();
22+
owner.ShouldBe(expectedOwner);
23+
repo.ShouldBe(expectedRepo);
2424
}
2525

2626
[Theory]
@@ -33,7 +33,7 @@ public void TryParseGitHubUrl_WithInvalidUrls_ShouldReturnFalse(string url)
3333
var result = VFSGitHubExtensions.TryParseGitHubUrl(url, out _, out _);
3434

3535
// Assert
36-
result.Should().BeFalse();
36+
result.ShouldBeFalse();
3737
}
3838

3939
[Fact]
@@ -48,8 +48,8 @@ public async Task TryLoadGitHubRepositoryAsync_WithNonExistentRepo_ShouldReturnF
4848
"non-existent-repo-xyz789");
4949

5050
// Assert
51-
success.Should().BeFalse();
52-
result.Should().BeNull();
51+
success.ShouldBeFalse();
52+
result.ShouldBeNull();
5353
}
5454

5555
[Fact]
@@ -62,7 +62,7 @@ public async Task TryLoadGitHubRepositoryFromUrlAsync_WithInvalidUrl_ShouldRetur
6262
var (success, result) = await vfs.TryLoadGitHubRepositoryFromUrlAsync("not-a-valid-url");
6363

6464
// Assert
65-
success.Should().BeFalse();
66-
result.Should().BeNull();
65+
success.ShouldBeFalse();
66+
result.ShouldBeNull();
6767
}
6868
}

tests/Atypical.VirtualFileSystem.UnitTests/Atypical.VirtualFileSystem.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FluentAssertions" Version="8.8.0" />
9+
<PackageReference Include="Shouldly" Version="4.3.0" />
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
1111
<PackageReference Include="xunit" Version="2.9.3" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">

0 commit comments

Comments
 (0)