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:
parent
2627e03e97
commit
8664993ff6
3 changed files with 20 additions and 20 deletions
|
|
@ -183,13 +183,13 @@ public class DownloadHelperTest
|
||||||
|
|
||||||
String fileRelativePath;
|
String fileRelativePath;
|
||||||
|
|
||||||
if (OSHelper.IsLinux)
|
if (OSHelper.IsWindows)
|
||||||
{
|
{
|
||||||
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
|
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
|
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
IList<DebridClientFile> files =
|
IList<DebridClientFile> files =
|
||||||
|
|
@ -228,13 +228,13 @@ public class DownloadHelperTest
|
||||||
|
|
||||||
String fileRelativePath;
|
String fileRelativePath;
|
||||||
|
|
||||||
if (OSHelper.IsLinux)
|
if (OSHelper.IsWindows)
|
||||||
{
|
{
|
||||||
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
|
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileRelativePath = @"inside\lots\of\subdirectories\file.txt";
|
fileRelativePath = "inside/lots/of/subdirectories/file.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
IList<DebridClientFile> files =
|
IList<DebridClientFile> files =
|
||||||
|
|
@ -271,13 +271,13 @@ public class DownloadHelperTest
|
||||||
|
|
||||||
String fileRelativePath;
|
String fileRelativePath;
|
||||||
|
|
||||||
if (OSHelper.IsLinux)
|
if (OSHelper.IsWindows)
|
||||||
{
|
{
|
||||||
fileRelativePath = "Torrent Name/Saison 1/file.txt";
|
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
|
fileRelativePath = "Torrent Name/Saison 1/file.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
IList<DebridClientFile> files =
|
IList<DebridClientFile> files =
|
||||||
|
|
@ -317,13 +317,13 @@ public class DownloadHelperTest
|
||||||
|
|
||||||
String fileRelativePath;
|
String fileRelativePath;
|
||||||
|
|
||||||
if (OSHelper.IsLinux)
|
if (OSHelper.IsWindows)
|
||||||
{
|
{
|
||||||
fileRelativePath = "Torrent Name/Saison 1/file.txt";
|
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileRelativePath = @"Torrent Name\Saison 1\file.txt";
|
fileRelativePath = "Torrent Name/Saison 1/file.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
IList<DebridClientFile> files =
|
IList<DebridClientFile> files =
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@ namespace RdtClient.Service.Test.Helpers;
|
||||||
|
|
||||||
public static class OSHelper
|
public static class OSHelper
|
||||||
{
|
{
|
||||||
public static Boolean IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
public static Boolean IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,19 +94,19 @@ public class TorrentsTest
|
||||||
String torrentPath;
|
String torrentPath;
|
||||||
String filePath;
|
String filePath;
|
||||||
|
|
||||||
if (OSHelper.IsLinux)
|
if (OSHelper.IsWindows)
|
||||||
{
|
|
||||||
downloadPath = $"{settings.DownloadClient.DownloadPath}/{torrent.Category}";
|
|
||||||
torrentPath = $"{downloadPath}/{torrent.RdName}";
|
|
||||||
filePath = $"{torrentPath}/{downloads[0].FileName}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Settings.Get.DownloadClient.DownloadPath = settings.DownloadClient.DownloadPath = @"C:\Downloads";
|
Settings.Get.DownloadClient.DownloadPath = settings.DownloadClient.DownloadPath = @"C:\Downloads";
|
||||||
downloadPath = @$"{settings.DownloadClient.DownloadPath}\{torrent.Category}";
|
downloadPath = @$"{settings.DownloadClient.DownloadPath}\{torrent.Category}";
|
||||||
torrentPath = @$"{downloadPath}\{torrent.RdName}";
|
torrentPath = @$"{downloadPath}\{torrent.RdName}";
|
||||||
filePath = @$"{torrentPath}\{downloads[0].FileName}";
|
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>
|
var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue