fix(tests): Fix tests to work on macos (and linux, and windows)

Windows is the odd OS out here, adjusting logic for test data.
This commit is contained in:
omgbeez 2026-04-20 19:44:07 -04:00 committed by Clifford Roche
parent 2627e03e97
commit 8664993ff6
3 changed files with 20 additions and 20 deletions

View file

@ -183,13 +183,13 @@ public class DownloadHelperTest
String fileRelativePath;
if (OSHelper.IsLinux)
if (OSHelper.IsWindows)
{
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
}
else
{
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
}
IList<DebridClientFile> files =
@ -228,13 +228,13 @@ public class DownloadHelperTest
String fileRelativePath;
if (OSHelper.IsLinux)
if (OSHelper.IsWindows)
{
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
}
else
{
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
}
IList<DebridClientFile> files =
@ -271,13 +271,13 @@ public class DownloadHelperTest
String fileRelativePath;
if (OSHelper.IsLinux)
if (OSHelper.IsWindows)
{
fileRelativePath = "Torrent Name/Saison 1/file.txt";
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
}
else
{
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
fileRelativePath = "Torrent Name/Saison 1/file.txt";
}
IList<DebridClientFile> files =
@ -317,13 +317,13 @@ public class DownloadHelperTest
String fileRelativePath;
if (OSHelper.IsLinux)
if (OSHelper.IsWindows)
{
fileRelativePath = "Torrent Name/Saison 1/file.txt";
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
}
else
{
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
fileRelativePath = "Torrent Name/Saison 1/file.txt";
}
IList<DebridClientFile> files =

View file

@ -4,5 +4,5 @@ namespace RdtClient.Service.Test.Helpers;
public static class OSHelper
{
public static Boolean IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
public static Boolean IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
}

View file

@ -94,19 +94,19 @@ public class TorrentsTest
String torrentPath;
String filePath;
if (OSHelper.IsLinux)
{
downloadPath = $"{settings.DownloadClient.DownloadPath}/{torrent.Category}";
torrentPath = $"{downloadPath}/{torrent.RdName}";
filePath = $"{torrentPath}/{downloads[0].FileName}";
}
else
if (OSHelper.IsWindows)
{
Settings.Get.DownloadClient.DownloadPath = settings.DownloadClient.DownloadPath = @"C:\Downloads";
downloadPath = @$"{settings.DownloadClient.DownloadPath}\{torrent.Category}";
torrentPath = @$"{downloadPath}\{torrent.RdName}";
filePath = @$"{torrentPath}\{downloads[0].FileName}";
}
else
{
downloadPath = $"{settings.DownloadClient.DownloadPath}/{torrent.Category}";
torrentPath = $"{downloadPath}/{torrent.RdName}";
filePath = $"{torrentPath}/{downloads[0].FileName}";
}
var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData>
{