public void BindTo_BindToNullEventDispatcher_ArgumentNullException()
        {
            AnonymousEventDispatcher eventDispatcher = null;
            var preloader = new AddressablesPreloader();

            Assert.Throws <ArgumentNullException>(() => { preloader.BindTo(eventDispatcher); });
            Assert.That(preloader.IsDisposed, Is.True);
        }
        public void BindTo_BindToEventDispatcher()
        {
            var eventDispatcher = new AnonymousEventDispatcher();
            var preloader       = new AddressablesPreloader().BindTo(eventDispatcher);

            Assert.That(preloader.IsDisposed, Is.False);
            eventDispatcher.Dispatch();
            Assert.That(preloader.IsDisposed, Is.True);
        }
示例#3
0
        public IEnumerator BindTo_BindToNullEventDispatcher_ArgumentNullException()
        {
            AnonymousEventDispatcher eventDispatcher = null;
            var referenceCounter = new ReferenceCounter(TestStrings.TestPrefabPath);
            var handle           = Addressables.LoadAssetAsync <GameObject>(TestStrings.TestPrefabAddress);

            Assert.Throws <ArgumentNullException>(() => { handle.BindTo(eventDispatcher); });
            yield return(handle);

            Assert.That(referenceCounter.ReferenceCount, Is.Zero);
        }
示例#4
0
        public IEnumerator BindTo_BindToEventDispatcher()
        {
            var eventDispatcher  = new AnonymousEventDispatcher();
            var referenceCounter = new ReferenceCounter(TestStrings.TestPrefabPath);
            var handle           = Addressables.LoadAssetAsync <GameObject>(TestStrings.TestPrefabAddress).BindTo(eventDispatcher);

            yield return(handle);

            Assert.That(referenceCounter.ReferenceCount, Is.EqualTo(1));
            eventDispatcher.Dispatch();
            Assert.That(referenceCounter.ReferenceCount, Is.Zero);
        }