public void Should_Be_Active_On_Start() { var system = new LabelSystem(_channelManager, 10, new[] {"default"}); Assert.False(system.IsActive); system.Start(); Assert.True(system.IsActive); }
public void Should_Notify_AddedToGameManager_When_Added_To_GameManager() { var raised = false; const bool expected = true; var em = new EntityManager(_channelManager, new EntityPool()); var tgm = new TestGameManager(new DefaultEntityAspectManager(_channelManager, em), em, _systemManager); var system = new LabelSystem(_channelManager, 10, new[] {"default"}); system.AddedToGameManager += (s, e) => raised = true; system.AddToGameManager(tgm); Assert.Equal(expected, raised); }
public void System_CompareTo_Should_Sort_Correctly() { var systems = new List<BaseSystem>(); var sys1 = new LabelSystem(_channelManager, 30); var sys2 = new LabelSystem(_channelManager, 10); var sys3 = new LabelSystem(_channelManager, 40); systems.Add(sys1); systems.Add(sys2); systems.Add(sys3); systems.Sort(); Assert.Equal(sys2.Priority, systems[0].Priority); Assert.Equal(sys1.Priority, systems[1].Priority); Assert.Equal(sys3.Priority, systems[2].Priority); }
public void SystemRemoved_Should_Notify_Only_If_Flag_Is_Set(bool shouldNotify) { var notified = false; var system = new LabelSystem(_channelManager, 10); _gameManager.AddSystem(system); _gameManager.SystemRemoved += (s, e) => notified = true; _gameManager.RemoveSystem<LabelSystem>(shouldNotify); Assert.Equal(shouldNotify, notified); }
public void System_Should_Not_Be_Available_After_Removed_From_Game_Manager() { var system = new LabelSystem(_channelManager, 10); _gameManager.AddSystem(system); Assert.True(_gameManager.Systems.GetBySystemType(system.GetType()) != null); _gameManager.RemoveSystem<LabelSystem>(false); Assert.True(_gameManager.Systems.GetBySystemType(typeof (LabelSystem)) == null); }
public void RemoveSystem_Should_Reduce_Count_Of_Systems() { var system = new LabelSystem(_channelManager, 10); Assert.Equal(0, _gameManager.Systems.Count()); _gameManager.AddSystem(system); Assert.Equal(1, _gameManager.Systems.Count()); _gameManager.RemoveSystem<LabelSystem>(false); Assert.Equal(0, _gameManager.Systems.Count()); }
public void SystemAdded_Should_Notify_After_System_Is_Added() { var notified = false; var system = new LabelSystem(_channelManager, 10); _gameManager.SystemAdded += (s, e) => notified = true; _gameManager.AddSystem(system); Assert.True(notified); }
public void System_Should_Be_Available_After_Added_To_Game_Manager() { var system = new LabelSystem(_channelManager, 10); _gameManager.AddSystem(system); Assert.True(_gameManager.Systems.GetBySystemType(system.GetType()) != null); }
public void AddSystem_Should_Increase_Count_Of_Systems() { const int expected = 1; var system = new LabelSystem(_channelManager, 10); Assert.Equal(0, _gameManager.Systems.Count()); _gameManager.AddSystem(system); Assert.Equal(expected, _gameManager.Systems.Count()); }