protected void DoGetRelativeFileName(bool iRelativeToPath, string iBaseFileName, string iFileName, string iExpected)
        {
            try
            {
                if (iRelativeToPath)
                {
                    iBaseFileName = PathUtils.AddEndingDirectorySeparator(Path.GetDirectoryName(iBaseFileName));
                }

                string vActual = RelativePath.GetRelativeFileName(iBaseFileName, iFileName);
                Assert.AreEqual(iExpected, vActual, GetTestFailMessage(iBaseFileName, iFileName));
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message + "; " + GetTestFailMessage(iBaseFileName, iFileName));
            }
        }
Ejemplo n.º 2
0
 protected void TestCombine(string iBasePath)
 {
     try
     {
         string vBasePath = PathUtils.AddEndingDirectorySeparator(iBasePath);
         TestCombine(iBasePath, @"c:\", @"c:\", iBasePath != "");
         TestCombine(iBasePath, @"c:\temp", @"c:\temp", iBasePath != "");
         TestCombine(iBasePath, @"c:", @"c:", iBasePath != "");
         TestCombine(iBasePath, @"\temp", vBasePath + @"temp", false);
         TestCombine(iBasePath, @"temp", vBasePath + @"temp", false);
         TestCombine(iBasePath, @"\", vBasePath, false);
         TestCombine(iBasePath, @"", vBasePath, false);
     }
     catch (Exception e)
     {
         DoFail(e.Message, iBasePath, "");
     }
 }
Ejemplo n.º 3
0
        protected void TestAddEndingDirectorySeparator_List(IList <string> iPaths, IList <string> iExpected)
        {
            IList <string> vActual = PathUtils.AddEndingDirectorySeparator(iPaths);

            CompareLists(vActual, iExpected, "");
        }
Ejemplo n.º 4
0
        protected void TestAddEndingDirectorySeparator(string iPath, string iExpected)
        {
            string vActual = PathUtils.AddEndingDirectorySeparator(iPath);

            Assert.AreEqual(iExpected, vActual, "Test value: " + iPath);
        }