From 62b7b3bae90e3b6ffad494b42c80b365a3eb8396 Mon Sep 17 00:00:00 2001 From: Ionite Date: Tue, 27 Jun 2023 01:32:12 -0400 Subject: [PATCH] Add GetSubPath tests --- .../Models/InstalledPackageTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 StabilityMatrix.Tests/Models/InstalledPackageTests.cs diff --git a/StabilityMatrix.Tests/Models/InstalledPackageTests.cs b/StabilityMatrix.Tests/Models/InstalledPackageTests.cs new file mode 100644 index 00000000..4fe4985c --- /dev/null +++ b/StabilityMatrix.Tests/Models/InstalledPackageTests.cs @@ -0,0 +1,18 @@ +using StabilityMatrix.Models; + +namespace StabilityMatrix.Tests.Models; + +[TestClass] +public class InstalledPackageTests +{ + [DataTestMethod] + [DataRow("C:\\User\\AppData\\StabilityMatrix", "C:\\User\\Other", null)] + [DataRow("C:\\Data", "D:\\Data\\abc", null)] + [DataRow("C:\\Data", "C:\\Data\\abc", "abc")] + [DataRow("C:\\User\\AppData\\StabilityMatrix", "C:\\User\\AppData\\StabilityMatrix\\Packages\\abc", "Packages\\abc")] + public void TestGetSubPath(string relativeTo, string path, string? expected) + { + var result = InstalledPackage.GetSubPath(relativeTo, path); + Assert.AreEqual(expected, result); + } +}