Example #1
0
        public void TestCreateFriendlyFilePath()
        {
            foreach (var testCase in Triples(
                         @"C:\a\b", @"C:\file.exe", @"..\..\file.exe",
                         @"C:\a\b", @"C:\a\file.exe", @"..\file.exe",
                         @"C:\a\b", @"C:\a\b\file.exe", @"file.exe",
                         @"C:\a\b", @"C:\a\b\c\file.exe", @"c\file.exe",
                         @"C:\a\b", @"D:\a\b\file.exe", @"D:\a\b\file.exe",

                         @"\\pc\share\a\b", @"\\pc\share\file.exe", @"..\..\file.exe",
                         @"\\pc\share\a\b", @"\\pc\share\a\file.exe", @"..\file.exe",
                         @"\\pc\share\a\b", @"\\pc\share\a\b\file.exe", @"file.exe",
                         @"\\pc\share\a\b", @"\\pc\share\a\b\c\file.exe", @"c\file.exe",
                         @"\\pc\share\a\b", @"\\pc\othershare\a\b\file.exe", @"..\..\..\othershare\a\b\file.exe",

                         @"ftp://[email protected]/a/b", @"ftp://[email protected]/file.exe", @"../../file.exe",
                         @"ftp://[email protected]/a/b", @"ftp://[email protected]/a/file.exe", @"../file.exe",
                         @"ftp://[email protected]/a/b", @"ftp://[email protected]/a/b/file.exe", @"file.exe",
                         @"ftp://[email protected]/a/b", @"ftp://[email protected]/a/b/c/file.exe", @"c/file.exe",
                         @"ftp://[email protected]/a/b", @"ftp://[email protected]/a/b/file.exe", @"ftp://[email protected]/a/b/file.exe"
                         ))
            {
                var expected = testCase.Item3;
                var actual   = CommonUtils.CreateFriendlyFilePath(testCase.Item1, testCase.Item2);

                Assert.AreEqual(expected, actual);
            }
        }