public void TestCollide() { myEnergizer = new Energizer(myGameState.GhostSquad); myEnergizer.Collision += myGameState.Score.incrementScore; myEnergizer.Collide(); Assert.AreEqual(100, myGameState.Score.Score); myEnergizer.Collide(); Assert.AreEqual(200, myGameState.Score.Score); foreach (Ghost ghost in myGameState.GhostSquad) { Assert.AreEqual(GhostState.Scared, ghost.CurrentState); } }
public void CollisionEventRaisedTest() { Boolean actual = false; Boolean expected = true; Energizer e = new Energizer(); e.CollisionEvent += (x) => { x.Points += 100; actual = true; }; e.Collide(); Assert.AreEqual(expected, actual); }