Skip to content

Commit

Permalink
fix: Path.GetTempPath should end with directory separator (#1172)
Browse files Browse the repository at this point in the history
`Path.GetTempPath` should end with directory separator
  • Loading branch information
vbreuss authored Dec 3, 2024
1 parent 3e4b4e2 commit d439c7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace System.IO.Abstractions.TestingHelpers
public class MockFileSystem : FileSystemBase, IMockFileDataAccessor
{
private const string DEFAULT_CURRENT_DIRECTORY = @"C:\";
private const string TEMP_DIRECTORY = @"C:\temp";
private const string TEMP_DIRECTORY = @"C:\temp\";

private readonly IDictionary<string, FileSystemEntry> files;
private readonly IDictionary<string, MockDriveData> drives;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,20 @@ public void GetTempPath_Called_ReturnsStringLengthGreaterThanZero()
Assert.That(result.Length > 0, Is.True);
}

[Test]
public void GetTempPath_ShouldEndWithDirectorySeparator()
{
//Arrange
var mockPath = new MockFileSystem().Path;
var directorySeparator = mockPath.DirectorySeparatorChar.ToString();

//Act
var result = mockPath.GetTempPath();

//Assert
Assert.That(result, Does.EndWith(directorySeparator));
}

[Test]
[TestCase(null)]
[TestCase("")]
Expand Down

0 comments on commit d439c7f

Please sign in to comment.