예제 #1
0
        public void TestGetRelativeWindows(string expectedRelPath, bool isChild, string absolutePath, string basePath)
        {
            PlatformTestUtils.OnlyRunOnWindows();

            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));
        }
예제 #2
0
        [DataRow(false, @"C:\Program Files (x86)", @"C:\Program Files")]         // not naive StartsWith
        public void TestIsSubfolderOfWindows(bool expectedIsSubfolder, string childPath, string parentPath)
        {
            PlatformTestUtils.OnlyRunOnWindows();

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