Beispiel #1
0
        public void TestGetRelativeUnix(string expectedRelPath, bool isChild, string absolutePath, string basePath)
        {
            PlatformTestUtils.OnlyRunOnRealUnix();

            Assert.AreEqual(expectedRelPath, PE.GetRelativePath(fromPath: basePath, toPath: absolutePath));             // params swapped w.r.t. `MakeRelativeTo`
            // `MakeRelativeTo` is supposed to return an absolute path (the receiver is assumed to be absolute) iff the receiver isn't a child of the given base path
            Assert.AreEqual(isChild ? expectedRelPath : absolutePath, absolutePath.MakeRelativeTo(basePath));
        }
Beispiel #2
0
        [DataRow(true, "/usr/lib64/gconv", "/usr/lib")]   // same symlink, checking child
        public void TestIsSubfolderOfUnix(bool expectedIsSubfolder, string childPath, string parentPath)
        {
            PlatformTestUtils.OnlyRunOnRealUnix();

            Assert.AreEqual(expectedIsSubfolder, childPath.IsSubfolderOf(parentPath));
        }