Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix tests on Linux/MacOS
  • Loading branch information
vbreuss committed Sep 6, 2025
commit 0a3932c9ef506cf907647e831e6710d0be0f4062
12 changes: 8 additions & 4 deletions Source/Testably.Abstractions.Testing/Storage/InMemoryStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,14 @@ public IEnumerable<IStorageDrive> GetDrives()
drive = _fileSystem.Storage.MainDrive;
}

string fullPath = path;
if (!fullPath.IsUncPath(_fileSystem) ||
!_fileSystem.Execute.IsNetFramework ||
fullPath.LastIndexOf(_fileSystem.Path.DirectorySeparatorChar) > 2)
string fullPath;
if (path.IsUncPath(_fileSystem) &&
_fileSystem.Execute is { IsNetFramework: true } or {IsWindows: false } &&
path.LastIndexOf(_fileSystem.Path.DirectorySeparatorChar) <= 2)
{
fullPath = path;
}
else
{
fullPath = path.GetFullPathOrWhiteSpace(_fileSystem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ await That(drives).HasSingle().Matching(d
[Fact]
public async Task WithDrive_ShouldInitializeDrivesWithRootDirectory()
{
Skip.IfNot(Test.RunsOnWindows, "Linux does not support different drives.");

MockFileSystem sut = new MockFileSystem().WithDrive("V");
List<IFileSystemInfo> fileSystemInfos = sut.DriveInfo.GetDrives()
.SelectMany(drive => drive.RootDirectory
Expand Down Expand Up @@ -324,8 +326,8 @@ public async Task WithUncDrive_ShouldInitializeDrivesWithRootDirectory()
{
MockFileSystem sut = new();
string uncPrefix = new(sut.Path.DirectorySeparatorChar, 2);
string uncDrive = $"{uncPrefix}unc-server";
sut.WithUncDrive(uncDrive);
string uncDrive = $"{uncPrefix}UNC-Path";
sut.WithUncDrive("UNC-Path");
IDriveInfo drive = sut.DriveInfo.New(uncDrive);

List<IFileSystemInfo> fileSystemInfos = drive.RootDirectory
Expand Down
Loading