Example #1
0
        public void TestDbPath_ShouldtTryToParseInterpolatedString_PathShouldntBeEmpty()
        {
            var expectedDatabasePath = Path.Combine(Application.persistentDataPath, "foo/bar");
            var actualDatabasePath   = ClientPathHelper.GetFullPath(expectedDatabasePath);

            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
Example #2
0
        public void TestDbPath_ShouldTryToEscapeRootedDir_PathShouldntBeEmpty()
        {
            var testedPath           = "./test";
            var expectedDatabasePath = Path.Combine(Application.persistentDataPath, testedPath);
            var actualDatabasePath   = ClientPathHelper.GetFullPath(testedPath);

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

            var actualDatabasePath = ClientPathHelper.GetFullPath(testedDatabasePath);

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

            var actualDatabasePath = ClientPathHelper.GetFullPath(testedDatabasePath);

            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
Example #5
0
        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  = ClientPathHelper.GetFullPath(testedInvalidPath);

            Assert.AreEqual(Path.GetFullPath(expectedInvalidPath), actualDatabasePath);
        }
Example #6
0
        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 = ClientPathHelper.GetFullPath(expectedDatabasePath);
            Assert.AreEqual(new DirectoryInfo(expectedDatabasePath).FullName, actualDatabasePath);
        }
        /// <summary>
        /// Get full paths to attachments added by client
        /// </summary>
        /// <returns>List of absolute path to attachments</returns>
        public HashSet <string> GetAttachmentPaths()
        {
            var result = new HashSet <string>();

            if (AttachmentPaths == null || AttachmentPaths.Length == 0)
            {
                return(result);
            }

            foreach (var path in AttachmentPaths)
            {
                if (!string.IsNullOrEmpty(path))
                {
                    result.Add(ClientPathHelper.GetFullPath(path));
                }
            }
            return(result);
        }
 public string GetFullDatabasePath()
 {
     return(ClientPathHelper.GetFullPath(DatabasePath));
 }
Example #9
0
 public void TestDbPath_EmptyPathToDatabase_PathShouldBeEmpty()
 {
     Assert.IsEmpty(ClientPathHelper.GetFullPath(string.Empty));
 }