Skip to content

Commit

Permalink
Add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Apr 19, 2024
1 parent 8a51bed commit 9b30a65
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ public void GetFileName_EmptyString_ShouldReturnEmptyString()
result.Should().Be(string.Empty);
}

[SkippableTheory]
[InlineData("foo/", "", TestOS.All)]
[InlineData("bar\\", "", TestOS.Windows)]
public void GetFileName_EndingWithDirectorySeparator_ShouldReturnExpectedResult(
string? path, string? expected, TestOS operatingSystem)
{
Skip.IfNot(Test.RunsOn(operatingSystem));

string? result = FileSystem.Path.GetFileName(path);

result.Should().Be(expected);
}

[SkippableFact]
public void GetFileName_Null_ShouldReturnNull()
{
Expand Down Expand Up @@ -63,6 +50,21 @@ public void GetFileName_Span_ShouldReturnDirectory(
}
#endif

[SkippableTheory]
[InlineData("foo/", "", TestOS.All)]
[InlineData("bar\\", "", TestOS.Windows)]
[InlineData("/foo", "foo", TestOS.All)]
[InlineData("\\bar", "bar", TestOS.Windows)]
public void GetFileName_SpecialCases_ShouldReturnExpectedResult(
string? path, string? expected, TestOS operatingSystem)
{
Skip.IfNot(Test.RunsOn(operatingSystem));

string? result = FileSystem.Path.GetFileName(path);

result.Should().Be(expected);
}

[SkippableTheory]
[AutoData]
public void GetFileName_WithoutDirectory_ShouldReturnFilename(string filename)
Expand Down

0 comments on commit 9b30a65

Please sign in to comment.