public void TestDbPath_ShouldtTryToParseInterpolatedString_PathShouldntBeEmpty()
        {
            var expectedDatabasePath = Path.Combine(Application.persistentDataPath, "foo", "bar");
            var actualDatabasePath   = DatabasePathHelper.GetFullDatabasePath(expectedDatabasePath);

            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
        public void TestDbPath_ShouldTryToEscapeRootedDir_PathShouldntBeEmpty()
        {
            var testedPath           = "./test";
            var expectedDatabasePath = Path.Combine(Application.persistentDataPath, testedPath);
            var actualDatabasePath   = DatabasePathHelper.GetFullDatabasePath(testedPath);

            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
        public void TestDbPath_ShouldParseCorrectlyInterpolatedStringWithLowerCaseChar_PathShouldntBeEmpty()
        {
            var expectedDatabasePath = Path.Combine(Application.persistentDataPath, "foo", "bar");
            var testedDatabasePath   = "${application.persistentDataPath}/foo/bar";

            var actualDatabasePath = DatabasePathHelper.GetFullDatabasePath(testedDatabasePath);

            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
        public void TestDbPath_ShouldReplaceInterpolationWithPersistentDataPathDataPath_PathShouldntBeEmpty()
        {
            var expectedDatabasePath = Path.Combine(Application.persistentDataPath, "foo", "bar");
            var testedDatabasePath   = "${Application.persistentDataPath}/foo/bar";

            var actualDatabasePath = DatabasePathHelper.GetFullDatabasePath(testedDatabasePath);

            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
        public void TestDbPath_ShouldHandleIncorrectInterpolationClosingValue_ShouldReturnInvalidPathToDatabase()
        {
            var testedInvalidPath = "${application.persistentDataPath/foo/bar";
            // beacuse ${ will point to root dir of project, we will try to extend this path
            // with application.dataPath
            var expectedInvalidPath = Path.Combine(Application.persistentDataPath, testedInvalidPath);
            var actualDatabasePath  = DatabasePathHelper.GetFullDatabasePath(testedInvalidPath);

            Assert.AreEqual(Path.GetFullPath(expectedInvalidPath), actualDatabasePath);
        }
        public void TestDbPath_ShouldCorrectlyGenerateFullpath_PathShouldntBeEmpty()
        {
            var expectedDatabasePath =
#if UNITY_EDITOR_OSX || UNITY_IOS || UNITY_STANDALONE_OSX
                "/Users/user/Library/Application Support/Backtrace/database/path";
#else
                "C:/users/user/Backtrace/database/path";
#endif

            var actualDatabasePath = DatabasePathHelper.GetFullDatabasePath(expectedDatabasePath);
            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
 public string GetFullDatabasePath()
 {
     return(DatabasePathHelper.GetFullDatabasePath(DatabasePath));
 }
 public void TestDbPath_EmptyPathToDatabase_PathShouldBeEmpty()
 {
     Assert.IsEmpty(DatabasePathHelper.GetFullDatabasePath(string.Empty));
 }