Skip to content

Commit

Permalink
Add missing test for ChangeExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Apr 16, 2024
1 parent 1599ebb commit 75396c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private abstract class SimulatedPath(MockFileSystem fileSystem) : IPath

if (extension == null)
{
extension ??= "";
extension = "";
}
else if (!extension.StartsWith('.'))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ public void ChangeExtension_WithDotOnlyInDirectory_ShouldAppendExtensionToPath(
result.Should().Be(expectedResult);
}

[SkippableTheory]
[AutoData]
public void ChangeExtension_WithFileStartingWithDot_ShouldAppendExtensionToPath(
string fileName, string extension)
{
string path = $".{fileName}";
string expectedResult = $".{extension}";

string result = FileSystem.Path.ChangeExtension(path, extension);

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

[SkippableTheory]
[AutoData]
public void ChangeExtension_WithLeadingDotInExtension_ShouldNotIncludeTwoDots(
Expand Down

0 comments on commit 75396c7

Please sign in to comment.