public void UpdateCalledOnEnabledIUpdatableGameComponent() { TestGame game = new TestGame(new NullEventSource()); GameComponentTestBase gc = new GameComponentTestBase(game); game.Components.Add(gc); game.Run(); Assert.AreEqual(1, gc.CountUpdate); }
public void InitializeCalledOnIGameComponentTest() { TestGame game = new TestGame(new NullEventSource()); GameComponentTestBase gc = new GameComponentTestBase(game); game.Components.Add(gc); game.Run(); Assert.AreEqual(1, gc.CountInitialize); }
public void UpdateCalledOnceForIUpdatableGameComponent() { DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e) { GameComponentTestBase u = (GameComponentTestBase)e.Game.Components[0]; u.Enabled = false; for (int i = 0; i < 5; i++) { TestClock.Instance.Step(100); e.Game.Tick(); } }); TestGame game = new TestGame(evt); GameComponentTestBase gc = new GameComponentTestBase(game); game.Components.Add(gc); game.Run(); Assert.AreEqual(1, gc.CountUpdate); }
public void UpdateNotCalledOnDisabledIUpdatableGameComponent() { TestGame game = new TestGame(new NullEventSource()); GameComponentTestBase gc = new GameComponentTestBase(game); game.Components.Add(gc); gc.Enabled = false; game.Run(); Assert.AreEqual(0, gc.CountUpdate); }