示例#1
0
 public void TestCombine(string path1, string path2, string expected)
 {
     Assert.That(
         UnityPathUtils.Combine(path1, path2),
         Is.EqualTo(expected)
         );
 }
示例#2
0
        public void TestRelativeToAbsolute()
        {
            string absPath = UnityPathUtils.Combine(Application.dataPath, "Things/test.txt");
            string relPath = UnityPathUtils.Combine("Assets", "Things/test.txt");

            Assert.That(
                UnityPathUtils.RelativeToAbsolute(relPath),
                Is.EqualTo(absPath)
                );
        }
        public void TestCombine(string path1, string path2, string expected)
        {
            path1    = path1.Replace('/', Path.DirectorySeparatorChar);
            path2    = path2.Replace('/', Path.DirectorySeparatorChar);
            expected = expected.Replace('/', Path.DirectorySeparatorChar);

            Assert.That(
                UnityPathUtils.Combine(path1, path2),
                Is.EqualTo(expected)
                );
        }
        public void TestRelativeToAbsolute()
        {
            // Gotta do this because we need consistent directory separators.
            string dataPath = Application.dataPath.Replace('/', Path.DirectorySeparatorChar);
            string basePath = UnityPathUtils.Combine("Things", "test.txt");

            string absPath = UnityPathUtils.Combine(dataPath, basePath);
            string relPath = UnityPathUtils.Combine("Assets", basePath);

            Assert.That(
                UnityPathUtils.RelativeToAbsolute(relPath),
                Is.EqualTo(absPath)
                );
        }
示例#5
0
        public void TestInvalidRelativePath()
        {
            string testPath = UnityPathUtils.Combine(Application.dataPath, "Things/test.txt");

            Assert.That(UnityPathUtils.IsRelativePath(testPath), Is.False);
        }
示例#6
0
        public void TestValidRelativePath()
        {
            string testPath = UnityPathUtils.Combine("Assets", "Things/test.txt");

            Assert.That(UnityPathUtils.IsRelativePath(testPath), Is.True);
        }