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); }
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); }
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); }