Exemple #1
0
        public void MultiTargetCompletion()
        {
            using (var test = new AssetDependencyTracker <int>(typeof(TestImporter), "stuff"))
                using (var list = new NativeList <AssetDependencyTracker <int> .Completed>(0, Allocator.Persistent))
                {
                    var path = _Temp.GetNextPath();
                    var guid = WriteFileAndRefresh(path, "boing");

                    test.Add(guid, 0, true);
                    test.Add(guid, 1, true);
                    test.Add(guid, 2, false);

                    // Remove this one again
                    // (Ensure that we dont get events about user data we already removed)
                    test.Remove(guid, 1);

                    test.GetCompleted(list);

                    Assert.AreEqual(1, test.TotalAssets);
                    Assert.AreEqual(0, test.InProgressAssets);

                    Assert.AreEqual(2, list.Length);
                    Assert.AreEqual(guid, list[0].Asset);
                    Assert.AreEqual(guid, list[1].Asset);

                    Assert.AreEqual(2, list[0].UserKey);
                    Assert.AreEqual(0, list[1].UserKey);

                    Assert.AreEqual(list[1].ArtifactID, list[0].ArtifactID);
                    Assert.AreNotEqual(default(Hash128), list[0].ArtifactID);
                }
        }
Exemple #2
0
        public void TestMissingAsset()
        {
            using (var test = new AssetDependencyTracker <int>(typeof(TestImporter), "stuff"))
                using (var list = new NativeList <AssetDependencyTracker <int> .Completed>(0, Allocator.Persistent))
                {
                    var guid = GUID.Generate();
                    test.Add(guid, 1, true);

                    test.GetCompleted(list);

                    AssertDontExist(list, guid, 1);

                    AssetDatabase.Refresh();
                    test.GetCompleted(list);
                    Assert.AreEqual(0, list.Length);
                }
        }
Exemple #3
0
        public void ImbalancedRegistrationThrows()
        {
            using (var test = new AssetDependencyTracker <int>(typeof(TestImporter), "stuff"))
            {
                var guid = GUID.Generate();
                test.Add(guid, 0, true);

                Assert.Throws <ArgumentException>(() =>
                {
                    test.Add(guid, 0, true);
                });
                Assert.Throws <ArgumentException>(() =>
                {
                    test.Remove(guid, 8);
                });
                Assert.Throws <ArgumentException>(() =>
                {
                    test.Remove(default, 0);