Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="8.8.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void FullRepositoryName_ShouldCombineOwnerAndRepo()
var result = CreateTestResult();

// Act & Assert
result.FullRepositoryName.Should().Be("testowner/testrepo");
result.FullRepositoryName.ShouldBe("testowner/testrepo");
}

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

// Act & Assert
result.FilesSkipped.Should().Be(2);
result.FilesSkipped.ShouldBe(2);
}

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

// Act & Assert
result.HasSkippedFiles.Should().BeTrue();
result.HasSkippedFiles.ShouldBeTrue();
}

[Fact]
Expand All @@ -54,7 +54,7 @@ public void HasSkippedFiles_ShouldReturnFalseWhenNoFilesSkipped()
var result = CreateTestResult();

// Act & Assert
result.HasSkippedFiles.Should().BeFalse();
result.HasSkippedFiles.ShouldBeFalse();
}

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

// Assert
summary.Should().Contain(expectedSize);
summary.ShouldContain(expectedSize);
}

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

// Assert
summary.Should().Contain("3 files skipped");
summary.ShouldContain("3 files skipped");
}

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

// Assert
byReason.Should().ContainKey(SkipReason.TooLarge);
byReason[SkipReason.TooLarge].Should().HaveCount(2);
byReason[SkipReason.BinaryExcluded].Should().HaveCount(1);
byReason[SkipReason.ExtensionExcluded].Should().HaveCount(1);
byReason.ShouldContainKey(SkipReason.TooLarge);
byReason[SkipReason.TooLarge].Count.ShouldBe(2);
byReason[SkipReason.BinaryExcluded].Count.ShouldBe(1);
byReason[SkipReason.ExtensionExcluded].Count.ShouldBe(1);
}

private static GitHubLoadResult CreateTestResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ public void Default_ShouldHaveExpectedValues()
var options = GitHubLoaderOptions.Default;

// Assert
options.AccessToken.Should().BeNull();
options.Branch.Should().BeNull();
options.SubPath.Should().BeNull();
options.TargetPath.Should().Be("/");
options.MaxFileSize.Should().Be(1_048_576);
options.IncludeExtensions.Should().BeNull();
options.ExcludeExtensions.Should().BeNull();
options.ExcludePatterns.Should().BeNull();
options.IncludeBinaryFiles.Should().BeTrue();
options.Strategy.Should().Be(GitHubLoadingStrategy.Eager);
options.ProgressCallback.Should().BeNull();
options.AccessToken.ShouldBeNull();
options.Branch.ShouldBeNull();
options.SubPath.ShouldBeNull();
options.TargetPath.ShouldBe("/");
options.MaxFileSize.ShouldBe(1_048_576);
options.IncludeExtensions.ShouldBeNull();
options.ExcludeExtensions.ShouldBeNull();
options.ExcludePatterns.ShouldBeNull();
options.IncludeBinaryFiles.ShouldBeTrue();
options.Strategy.ShouldBe(GitHubLoadingStrategy.Eager);
options.ProgressCallback.ShouldBeNull();
}

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

// Assert
options.IncludeBinaryFiles.Should().BeFalse();
options.ExcludePatterns.Should().NotBeNull();
options.ExcludePatterns.Should().Contain("**/node_modules/**");
options.ExcludePatterns.Should().Contain("**/bin/**");
options.ExcludePatterns.Should().Contain("**/obj/**");
options.IncludeBinaryFiles.ShouldBeFalse();
options.ExcludePatterns.ShouldNotBeNull();
options.ExcludePatterns.ShouldContain("**/node_modules/**");
options.ExcludePatterns.ShouldContain("**/bin/**");
options.ExcludePatterns.ShouldContain("**/obj/**");
}

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

// Assert
options.IncludeBinaryFiles.Should().BeFalse();
options.IncludeExtensions.Should().NotBeNull();
options.IncludeExtensions.Should().Contain(".cs");
options.IncludeExtensions.Should().Contain(".csproj");
options.IncludeExtensions.Should().Contain(".sln");
options.ExcludePatterns.Should().Contain("**/bin/**");
options.ExcludePatterns.Should().Contain("**/obj/**");
options.IncludeBinaryFiles.ShouldBeFalse();
options.IncludeExtensions.ShouldNotBeNull();
options.IncludeExtensions.ShouldContain(".cs");
options.IncludeExtensions.ShouldContain(".csproj");
options.IncludeExtensions.ShouldContain(".sln");
options.ExcludePatterns.ShouldContain("**/bin/**");
options.ExcludePatterns.ShouldContain("**/obj/**");
}

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

// Assert
options.Strategy.Should().Be(GitHubLoadingStrategy.MetadataOnly);
options.Strategy.ShouldBe(GitHubLoadingStrategy.MetadataOnly);
}

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

// Assert
result.Should().Be(expected);
result.ShouldBe(expected);
}

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

// Assert
result.Should().Be(expected);
result.ShouldBe(expected);
}

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

// Assert
original.AccessToken.Should().BeNull();
modified.AccessToken.Should().Be("test-token");
modified.MaxFileSize.Should().Be(original.MaxFileSize);
original.AccessToken.ShouldBeNull();
modified.AccessToken.ShouldBe("test-token");
modified.MaxFileSize.ShouldBe(original.MaxFileSize);
}

[Fact]
Expand All @@ -131,9 +131,9 @@ public void WithRecord_ShouldSupportMultipleModifications()
};

// Assert
options.AccessToken.Should().Be("my-token");
options.Branch.Should().Be("develop");
options.MaxFileSize.Should().Be(5_000_000);
options.Strategy.Should().Be(GitHubLoadingStrategy.Lazy);
options.AccessToken.ShouldBe("my-token");
options.Branch.ShouldBe("develop");
options.MaxFileSize.ShouldBe(5_000_000);
options.Strategy.ShouldBe(GitHubLoadingStrategy.Lazy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public void TryParseGitHubUrl_WithValidUrls_ShouldReturnTrue(string url, string
var result = _loader.TryParseGitHubUrl(url, out var owner, out var repo);

// Assert
result.Should().BeTrue();
owner.Should().Be(expectedOwner);
repo.Should().Be(expectedRepo);
result.ShouldBeTrue();
owner.ShouldBe(expectedOwner);
repo.ShouldBe(expectedRepo);
}

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

// Assert
result.Should().BeFalse();
owner.Should().BeEmpty();
repo.Should().BeEmpty();
result.ShouldBeFalse();
owner.ShouldBeEmpty();
repo.ShouldBeEmpty();
}

[Fact]
public void Constructor_WithDefaultOptions_ShouldNotThrow()
{
// Act & Assert
var action = () => new GitHubRepositoryLoader();
action.Should().NotThrow();
action.ShouldNotThrow();
}

[Fact]
public void Constructor_WithAccessToken_ShouldNotThrow()
{
// Act & Assert
var action = () => new GitHubRepositoryLoader("test-token");
action.Should().NotThrow();
action.ShouldNotThrow();
}

[Fact]
Expand All @@ -84,7 +84,7 @@ public void Constructor_WithOptions_ShouldNotThrow()

// Act & Assert
var action = () => new GitHubRepositoryLoader(options);
action.Should().NotThrow();
action.ShouldNotThrow();
}

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

// Assert
await action.Should().ThrowAsync<ArgumentNullException>()
.WithParameterName("vfs");
var ex = await Should.ThrowAsync<ArgumentNullException>(action);
ex.ParamName.ShouldBe("vfs");
}

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

// Assert
await action.Should().ThrowAsync<ArgumentException>()
.WithParameterName("owner");
var ex = await Should.ThrowAsync<ArgumentException>(action);
ex.ParamName.ShouldBe("owner");
}

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

// Assert
await action.Should().ThrowAsync<ArgumentException>()
.WithParameterName("repository");
var ex = await Should.ThrowAsync<ArgumentException>(action);
ex.ParamName.ShouldBe("repository");
}

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

// Assert
await action.Should().ThrowAsync<ArgumentException>()
.WithParameterName("repositoryUrl");
var ex = await Should.ThrowAsync<ArgumentException>(action);
ex.ParamName.ShouldBe("repositoryUrl");
}

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

// Assert
success.Should().BeFalse();
result.Should().BeNull();
success.ShouldBeFalse();
result.ShouldBeNull();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// LICENSE file in the root directory of this source tree.

global using Xunit;
global using FluentAssertions;
global using Shouldly;
global using NSubstitute;
global using Atypical.VirtualFileSystem.Core;
global using Atypical.VirtualFileSystem.Core.Contracts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public void TryParseGitHubUrl_WithValidUrls_ShouldParse(string url, string expec
var result = VFSGitHubExtensions.TryParseGitHubUrl(url, out var owner, out var repo);

// Assert
result.Should().BeTrue();
owner.Should().Be(expectedOwner);
repo.Should().Be(expectedRepo);
result.ShouldBeTrue();
owner.ShouldBe(expectedOwner);
repo.ShouldBe(expectedRepo);
}

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

// Assert
result.Should().BeFalse();
result.ShouldBeFalse();
}

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

// Assert
success.Should().BeFalse();
result.Should().BeNull();
success.ShouldBeFalse();
result.ShouldBeNull();
}

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

// Assert
success.Should().BeFalse();
result.Should().BeNull();
success.ShouldBeFalse();
result.ShouldBeNull();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="8.8.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
Expand Down
Loading
Loading