public void ShouldReceiveModifiedEntity() { Filter testFilter = new Filter().AnyOf(typeof(FirstTestComponent)); testSystem.filter = testFilter; SystemObserver.Subscribe(testSystem); testEntity.AddComponent(new FirstTestComponent()); Assert.AreSame(testEntity, testSystem.receivedEntity); }
public void ShouldTriggerSystemIfComponentIsAddedAndMatches() { Filter testFilter = new Filter().AllOf(typeof(FirstTestComponent), typeof(SecondTestComponent)); testSystem.filter = testFilter; SystemObserver.Subscribe(testSystem); testEntity.AddComponent(new FirstTestComponent()); Assert.IsFalse(testSystem.isTriggered); testEntity.AddComponent(new SecondTestComponent()); Assert.IsTrue(testSystem.isTriggered); }
public void ShouldRemoveSystemWhenUnSubscribed() { SystemObserver.Subscribe(testSystem); SystemObserver.Unsubscribe(testSystem); Assert.AreEqual(0, SystemObserver.reactiveSystems.Count); }
public void ShouldIgnoreDuplicateSystems() { SystemObserver.Subscribe(testSystem); SystemObserver.Subscribe(testSystem); Assert.AreEqual(1, SystemObserver.reactiveSystems.Count); }
public void ThrowExceptionWhenSubscribeNullSystem() { SystemObserver.Subscribe(null); }
public void ShouldAddSystemWhenSubscribed() { SystemObserver.Subscribe(testSystem); Assert.AreEqual(1, SystemObserver.reactiveSystems.Count); }