public void WhenAFolderIsAddressable_FileEnumerationCache_CreatesFileTree()
 {
     using (var cache = new AddressablesFileEnumerationCache(Settings, false, null))
     {
         Assert.IsTrue(m_PrecomputedTree != null);
     }
 }
 public void WhenPrepopulateAssetsIsFalse_FileEnumerationCache_OnlyAddsAddressablesToTree()
 {
     using (var cache = new AddressablesFileEnumerationCache(Settings, false, null))
     {
         AddressableAssetTree.TreeNode node = m_PrecomputedTree.FindNode(m_ChildObjPath, false);
         Assert.IsTrue(node == null);
     }
 }
        public void WhenNoFolderIsAddressable_FileEnumerationCache_DoesNotCreateFileTree()
        {
            string parentFolderGuid = AssetDatabase.AssetPathToGUID(m_AddrParentFolderPath);
            string childFolderGuid  = AssetDatabase.AssetPathToGUID(m_AddrChildSubfolderPath);

            Settings.RemoveAssetEntry(parentFolderGuid);
            Settings.RemoveAssetEntry(childFolderGuid);

            using (var cache = new AddressablesFileEnumerationCache(Settings, true, null))
            {
                Assert.IsTrue(m_PrecomputedTree == null);
            }

            Settings.CreateOrMoveEntry(parentFolderGuid, m_ParentGroup);
            Settings.CreateOrMoveEntry(childFolderGuid, m_ChildGroup);
        }
        public void WhenNoFolderIsAddressable_EnumerateFiles_ReturnsNothing()
        {
            string parentFolderGuid = AssetDatabase.AssetPathToGUID(m_AddrParentFolderPath);
            string childFolderGuid  = AssetDatabase.AssetPathToGUID(m_AddrChildSubfolderPath);

            Settings.RemoveAssetEntry(parentFolderGuid);
            Settings.RemoveAssetEntry(childFolderGuid);

            using (var cache = new AddressablesFileEnumerationCache(Settings, true, null))
            {
                List <string> assetPaths = EnumerateAddressableFolder(m_TestFolderPath, Settings, false);
                Assert.AreEqual(0, assetPaths.Count);
            }

            Settings.CreateOrMoveEntry(parentFolderGuid, m_ParentGroup);
            Settings.CreateOrMoveEntry(childFolderGuid, m_ChildGroup);
        }
        List <string> GetValidAssetPaths(string path, AddressableAssetSettings settings)
        {
            List <string> pathsWithCache;

            using (var cache = new AddressablesFileEnumerationCache(settings, true, null))
            {
                pathsWithCache = EnumerateAddressableFolder(path, settings, true).ToList <string>();
            }
            List <string> pathsWithoutCache = EnumerateAddressableFolder(path, settings, true).ToList <string>();

            // Compare the results of two different code paths: with cache and without cache
            Assert.AreEqual(pathsWithCache.Count, pathsWithoutCache.Count);
            for (int i = 0; i < pathsWithCache.Count; i++)
            {
                Assert.AreEqual(pathsWithCache[i], pathsWithoutCache[i]);
            }
            return(pathsWithCache);
        }