public void OnPlayerDeath_gameOver() { //arrange // bool eventCaught=true; int lives = 1; //int score = 10; ScoreAndLife sl = new ScoreAndLife(lives, laserFactory, bombFactory); Player player = new Player(screenWidth, screenHeight, playerSpeed, playerWidth, playerHeight, laserFactory, bombFactory, sl, timerIntervalPlayerRespawn); Bunkers bunkers = new Bunkers(numBunkers, screenWidth, screenHeight, bunkerWidth, bunkerHeight, bunkerHealth, playerHeight, spaceBetweenBunkerAndPlayer); Mothership mothership = new Mothership(screenWidth, mothershipWidth, mothershipHeight, mothershipSpeed, mothershipPoints, timerIntervalMothership, mothershipSpacerFromTop); AlienSquad alienSquad = new AlienSquad(bunkers, bombFactory, laserFactory, player, mothership, sl, numRows, numColumns, screenWidth, player.BoundingBox.Height, alienWidth, alienHeight, alienSpeed, spacer, bombFrequency, alienPointStart, alienPointDecrement, alienSpacerFromTop, speedIncrease, bombFrequencyIncrement, bombFrequencyMin); //act laserFactory.RegisterAlienSquad(alienSquad); laserFactory.RegisterBunkers(bunkers); laserFactory.RegisterMothership(mothership); //sl.gameOver += delegate() //{ // eventCaught = true; //}; sl.OnPlayerDeath(); int result = sl.Lives; //assert Assert.AreEqual(0, result); //expected, actual //Assert.IsTrue(eventCaught); }
public void OnPlayerDeath_HaveLife() { //arrange int lives = 2; //int score = 10; ScoreAndLife sl = new ScoreAndLife(lives, laserFactory, bombFactory); //act sl.OnPlayerDeath(); int result = sl.Lives; //assert Assert.AreEqual(1, result); //expected, actual }