Browse Source

fix path tests on linux?

pull/55/head
JT 1 year ago
parent
commit
682fa49e80
  1. 6
      Jenkinsfile
  2. 13
      StabilityMatrix.Tests/Models/InstalledPackageTests.cs

6
Jenkinsfile vendored

@ -11,6 +11,7 @@ node("Diligence") {
git branch: env.BRANCH_NAME, credentialsId: 'Ionite', url: "https://github.com/${author}/${repoName}.git"
}
try {
stage('Test') {
sh "dotnet test StabilityMatrix.Tests"
}
@ -40,8 +41,11 @@ node("Diligence") {
archiveArtifacts artifacts: 'out/*.appimage', followSymlinks: false
}
}
} finally {
stage('Cleanup') {
cleanWs()
}
}
}

13
StabilityMatrix.Tests/Models/InstalledPackageTests.cs

@ -1,4 +1,5 @@
using StabilityMatrix.Core.Models;
using System.Runtime.InteropServices;
using StabilityMatrix.Core.Models;
namespace StabilityMatrix.Tests.Models;
@ -12,6 +13,16 @@ public class InstalledPackageTests
[DataRow("C:\\User\\AppData\\StabilityMatrix", "C:\\User\\AppData\\StabilityMatrix\\Packages\\abc", "Packages\\abc")]
public void TestGetSubPath(string relativeTo, string path, string? expected)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
relativeTo = relativeTo.Replace("C:\\", $"{Path.DirectorySeparatorChar}")
.Replace('\\', Path.DirectorySeparatorChar);
path = path.Replace("C:\\", $"{Path.DirectorySeparatorChar}")
.Replace('\\', Path.DirectorySeparatorChar);
expected = expected?.Replace("C:\\", $"{Path.DirectorySeparatorChar}")
.Replace('\\', Path.DirectorySeparatorChar);
}
var result = InstalledPackage.GetSubPath(relativeTo, path);
Assert.AreEqual(expected, result);
}

Loading…
Cancel
Save