Пример #1
0
        public void WhenGatherFolderEntries_ReturnsCorrectAssetObjects(bool includeSubObjects)
        {
            AddressableAssetEntry addrFolderEntry = null;
            string addressableFolderPath          = GetAssetPath("TestFolder");

            try
            {
                //Setup
                string folderGuid = CreateFolderDeep(addressableFolderPath);
                addrFolderEntry = Settings.CreateOrMoveEntry(folderGuid, m_testGroup, false);

                string testAssetPath = Path.Combine(addressableFolderPath, "testObject.asset").Replace('\\', '/');
                var    testAsset     = TestObject.Create("testObject", testAssetPath);
                testAsset.AddTestSubObject();

                //Test
                List <AddressableAssetEntry> entries = new List <AddressableAssetEntry>();
                addrFolderEntry.GatherFolderEntries(entries, true, includeSubObjects, null);
                if (includeSubObjects)
                {
                    Assert.AreEqual(entries.Count, 2, "GatherFolder entries was expected to return the Asset added and its subObject");
                }
                else
                {
                    Assert.AreEqual(entries.Count, 1, "GatherFolder entries was expected to only return the Asset added and not its subObject");
                }
            }
            finally
            {
                //Cleanup
                Settings.RemoveAssetEntry(addrFolderEntry, false);
                AssetDatabase.DeleteAsset(addressableFolderPath);
            }
        }