Exemplo n.º 1
0
    public void ModelRebuild_KeepsCorrect_BundlesToUpdate()
    {
        List <string> listOfPrefabs = new List <string>();

        string bundleName = "bundletest";

        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v1"));
        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v2"));

        TestUtil.ExecuteCodeAndCleanupAssets(() =>
        {
            Model.Rebuild();

            var rootChildList = ABModelUtil.Root.GetChildList();

            //Checks that the root has 1 bundle variant folder object as a child
            Assert.AreEqual(1, rootChildList.Count);
            Assert.AreEqual(typeof(BundleVariantFolderInfo), rootChildList.FirstOrDefault().GetType());

            BundleVariantFolderInfo folderInfo = rootChildList.FirstOrDefault() as BundleVariantFolderInfo;

            //Checks that the bundle variant folder object (mentioned above) has two children
            Assert.AreEqual(2, folderInfo.GetChildList().Count);
        }, listOfPrefabs);
    }
Exemplo n.º 2
0
    public void VerifyBasicTreeStructure_ContainsCorrect_ClassTypes()
    {
        // Account for existing bundles
        int numChildren = ABModelUtil.Root.GetChildList().Count;

        List <string> listOfPrefabs = new List <string>();
        string        bundleName    = "bundletest";

        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v1"));
        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v2"));

        TestUtil.ExecuteCodeAndCleanupAssets(() =>
        {
            Model.Refresh();

            var rootChildList = ABModelUtil.Root.GetChildList();
            Assert.AreEqual(numChildren + 1, rootChildList.Count);

            Type bundleVariantFolderInfoType  = typeof(BundleVariantFolderInfo);
            BundleVariantFolderInfo foundItem = null;
            foreach (BundleInfo item in rootChildList)
            {
                if (item.GetType() == bundleVariantFolderInfoType)
                {
                    foundItem = item as BundleVariantFolderInfo;
                    break;
                }
            }

            Assert.IsNotNull(foundItem);

            BundleInfo[] folderChildArray = foundItem.GetChildList().ToArray();
            Assert.AreEqual(2, folderChildArray.Length);

            Assert.AreEqual(typeof(BundleVariantDataInfo), folderChildArray[0].GetType());
            Assert.AreEqual(typeof(BundleVariantDataInfo), folderChildArray[1].GetType());
        }, listOfPrefabs);
    }
Exemplo n.º 3
0
    public void ModelRebuild_KeepsCorrect_BundlesToUpdate()
    {
        // Account for existing bundles
        int numChildren = ABModelUtil.Root.GetChildList().Count;

        List <string> listOfPrefabs = new List <string>();

        string bundleName = "bundletest";

        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v1"));
        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v2"));

        TestUtil.ExecuteCodeAndCleanupAssets(() =>
        {
            Model.Rebuild();

            var rootChildList = ABModelUtil.Root.GetChildList();

            //Checks that the root has 1 bundle variant folder object as a child
            Assert.AreEqual(numChildren + 1, rootChildList.Count);

            Type variantFolderType            = typeof(BundleVariantFolderInfo);
            BundleVariantFolderInfo foundItem = null;
            foreach (BundleInfo item in rootChildList)
            {
                if (item.GetType() == variantFolderType)
                {
                    foundItem = item as BundleVariantFolderInfo;
                    break;
                }
            }

            //Checks that the bundle variant folder object (mentioned above) has two children
            Assert.IsNotNull(foundItem);
            Assert.AreEqual(2, foundItem.GetChildList().Count);
        }, listOfPrefabs);
    }
Exemplo n.º 4
0
    public void VerifyBasicTreeStructure_ContainsCorrect_ClassTypes()
    {
        List <string> listOfPrefabs = new List <string>();
        string        bundleName    = "bundletest";

        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v1"));
        listOfPrefabs.Add(TestUtil.CreatePrefabWithBundleAndVariantName(bundleName, "v2"));

        TestUtil.ExecuteCodeAndCleanupAssets(() =>
        {
            Model.Refresh();

            var rootChildList = ABModelUtil.Root.GetChildList();
            Assert.AreEqual(1, rootChildList.Count);
            Assert.AreEqual(typeof(BundleVariantFolderInfo), rootChildList.FirstOrDefault().GetType());

            BundleVariantFolderInfo folderInfo = rootChildList.FirstOrDefault() as BundleVariantFolderInfo;
            BundleInfo[] folderChildArray      = folderInfo.GetChildList().ToArray();
            Assert.AreEqual(2, folderChildArray.Length);

            Assert.AreEqual(typeof(BundleVariantDataInfo), folderChildArray[0].GetType());
            Assert.AreEqual(typeof(BundleVariantDataInfo), folderChildArray[1].GetType());
        }, listOfPrefabs);
    }