mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Fixes file system domain unit test failing on UNIX systems
This commit is contained in:
1 parent
90e3237ec4
commit
b0b63a51cd
1 file changed
+7
-4
+7
-4
@@ -157,13 +157,16 @@ public class FileProviderServiceTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void GetFilePaths_ShouldOrderFilesAlphabetically()
|
public void GetFilePaths_WhenCalled_ShouldOrderFilesAlphabetically()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId();
|
FileSystemPathId path = _fileSystemPathIdFixture.CreateFileSystemPathId();
|
||||||
string[] files = s_isLinux
|
string[] files = s_isLinux
|
||||||
? new[] { "/C.txt", "/A.txt", "/B.txt" }
|
? ["/C.txt", "/A.txt", "/B.txt"]
|
||||||
: new[] { @"C:\C.txt", @"C:\A.txt", @"C:\B.txt" };
|
: [@"C:\C.txt", @"C:\A.txt", @"C:\B.txt"];
|
||||||
|
string[] expectedFiles = s_isLinux
|
||||||
|
? ["/A.txt", "/B.txt", "/C.txt"]
|
||||||
|
: [@"C:\A.txt", @"C:\B.txt", @"C:\C.txt"];
|
||||||
_mockFileSystemPermissionsService.CanAccessPath(path, FileAccessMode.ListDirectory).Returns(true);
|
_mockFileSystemPermissionsService.CanAccessPath(path, FileAccessMode.ListDirectory).Returns(true);
|
||||||
_mockFileSystem.Directory.GetFiles(path.Path).Returns(files);
|
_mockFileSystem.Directory.GetFiles(path.Path).Returns(files);
|
||||||
_mockFileSystem.File.GetAttributes(Arg.Any<string>()).Returns(FileAttributes.Normal);
|
_mockFileSystem.File.GetAttributes(Arg.Any<string>()).Returns(FileAttributes.Normal);
|
||||||
@@ -173,7 +176,7 @@ public class FileProviderServiceTests
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.IsError.Should().BeFalse();
|
result.IsError.Should().BeFalse();
|
||||||
result.Value.Select(x => x.Path).Should().BeEquivalentTo([@"C:\A.txt", @"C:\B.txt", @"C:\C.txt"], options => options.WithStrictOrdering());
|
result.Value.Select(x => x.Path).Should().BeEquivalentTo(expectedFiles, options => options.WithStrictOrdering());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
Reference in new issue
Block a user