Пример #1
0
 public void TestGetEditorFolder(string initPath, string expectedPath)
 {
     Assert.That(
         UnityPathUtils.GetEditorFolder(initPath),
         Is.EqualTo(expectedPath)
         );
 }
Пример #2
0
 public void TestIsInEditorAssembly(string path, bool expectedValue)
 {
     Assert.That(
         UnityPathUtils.IsInEditorAssembly(path),
         Is.EqualTo(expectedValue)
         );
 }
Пример #3
0
 public void TestCombine(string path1, string path2, string expected)
 {
     Assert.That(
         UnityPathUtils.Combine(path1, path2),
         Is.EqualTo(expected)
         );
 }
Пример #4
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 TestGetEditorFolder(string initPath, string expectedPath)
        {
            initPath     = initPath.Replace('/', Path.DirectorySeparatorChar);
            expectedPath = expectedPath.Replace('/', Path.DirectorySeparatorChar);

            Assert.That(
                UnityPathUtils.GetEditorFolder(initPath),
                Is.EqualTo(expectedPath)
                );
        }
        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)
                );
        }
Пример #8
0
        public void TestInvalidRelativePath()
        {
            string testPath = UnityPathUtils.Combine(Application.dataPath, "Things/test.txt");

            Assert.That(UnityPathUtils.IsRelativePath(testPath), Is.False);
        }
Пример #9
0
        public void TestValidRelativePath()
        {
            string testPath = UnityPathUtils.Combine("Assets", "Things/test.txt");

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