public void RemovesAndReturnsSystemForExistentType() { EntityWorld target = EmptyWorld(); var system = new FakeComponent1System(); target.AddSystem(system); Assert.Equal(system, target.RemoveSystem<FakeComponent1System>()); Assert.Equal(0, target.GetSystems().Count); }
public void ThrowsInvalidOperationForSystemInAnotherWorld() { EntityWorld target1 = EmptyWorld(); EntityWorld target2 = EmptyWorld(); var system = new FakeComponent1System(); target1.AddSystem(system); Assert.Throws<InvalidOperationException>(() => target2.AddSystem(system)); }
public void RemovesAndReturnsSystemForExistentType() { EntityWorld target = EmptyWorld(); var system = new FakeComponent1System(); target.AddSystem(system); Assert.Equal(system, target.RemoveSystem <FakeComponent1System>()); Assert.Empty(target.GetSystems()); }
public void ThrowsInvalidOperationForSystemInAnotherWorld() { EntityWorld target1 = EmptyWorld(); EntityWorld target2 = EmptyWorld(); var system = new FakeComponent1System(); target1.AddSystem(system); Assert.Throws <InvalidOperationException>(() => target2.AddSystem(system)); }
public void IsNotExecutedForComponentOfNoInterest() { var target = new FakeComponent1System(); var world = new EntityWorld(); world.AddSystem(target); var component = new FakeComponent2(); Entity entity = world.CreateEntity(); entity.AddComponent(component); world.Update(TimeSpan.Zero); Assert.False(component.Processed); }
public void IsNotExecutedForDrawSystemInUpdateLoop() { var target = new FakeComponent1System(); var world = new EntityWorld(); world.AddSystem(target); var component = new FakeComponent1(); Entity entity = world.CreateEntity(); entity.AddComponent(component); world.Draw(); Assert.False(component.Processed); }