public void AddNewSurvivorAtStart() { var game = new Game(); var John = new Survivor("John"); var successfullyAddedSurvivor = game.AddSurvivorToGame(John); Assert.IsTrue(successfullyAddedSurvivor); Assert.AreEqual(1, game.Survivors.Count()); }
public void RecordAddingSurvivorToGame() { var game = new Game(); var John = new Survivor("John"); game.AddSurvivorToGame(John); var lastEvent = game.GameHistory.LastOrDefault(); Assert.IsNotNull(lastEvent); Assert.IsTrue(lastEvent.EventDetail.StartsWith($"Survivor {John.Name} was added to the game")); }
public void SurvivorYellowThenGameLevelYellow() { var game = new Game(); var John = new Survivor("John", 15); var Whaley = new Survivor("Whaley", 6); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); Assert.AreEqual(Level.Yellow, game.Level); }
public void SurvivorBlueThenGameLevelBlue() { var game = new Game(); var John = new Survivor("John", 3); var Whaley = new Survivor("Whaley", 6); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); Assert.AreEqual(Level.Blue, game.Level); }
public void SurvivorsCantHaveTheSameName() { var game = new Game(); var John = new Survivor("John"); game.AddSurvivorToGame(John); var newJohn = new Survivor("John"); var successfullyAddedSurvivor = game.AddSurvivorToGame(newJohn); Assert.IsFalse(successfullyAddedSurvivor); Assert.AreEqual(1, game.Survivors.Count()); }
public void SurvivorRedThenGameLevelRed() { var game = new Game(); var John = new Survivor("John", 45); var Whaley = new Survivor("Whaley", 6); var pumpkin = new Survivor("Pumpkin", 20); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); game.AddSurvivorToGame(pumpkin); Assert.AreEqual(Level.Red, game.Level); }
public void RecordSurvivorKilleded() { var game = new Game(); var survivor = new Survivor("John"); game.AddSurvivorToGame(survivor);; survivor.ReceiveWound(2); var lastEvent = game.GameHistory.LastOrDefault(); Assert.IsNotNull(lastEvent); Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{survivor.Name} has been killed!")); }
public void RecordEquipmentPickedUpBySurvivor() { var game = new Game(); var survivor = new Survivor("John"); game.AddSurvivorToGame(survivor); var equipment = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat); survivor.PickUpItem(equipment); var lastEvent = game.GameHistory.LastOrDefault(); Assert.IsNotNull(lastEvent); Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{survivor.Name} picks up a piece of equipment ({equipment.Name})")); }
public void RecordSurvivorLevelUp() { var game = new Game(); var John = new Survivor("John", 6); var Whaley = new Survivor("Whaley", 10); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); John.KilledZombie(); var newLevel = John.Level; var lastEvent = game.GameHistory.LastOrDefault(); Assert.IsNotNull(lastEvent); Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{John.Name} has leveled up and is now {newLevel}")); }
public void AllSurvivorsDead_CheckEndOfGameFlag() { var game = new Game(); var John = new Survivor("John"); var Whaley = new Survivor("Whaley"); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); John.ReceiveWound(2); Whaley.ReceiveWound(2); Assert.IsFalse(John.IsAlive); Assert.IsFalse(Whaley.IsAlive); Assert.AreEqual(2, game.Survivors.Count()); Assert.IsTrue(game.IsEndOfGame); }
public void RecordEndOfGame() { var game = new Game(); var John = new Survivor("John"); var Whaley = new Survivor("Whaley"); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); John.ReceiveWound(2); Whaley.ReceiveWound(2); var continueGame = game.GameRound(); var lastEvent = game.GameHistory.LastOrDefault(); Assert.IsFalse(continueGame); Assert.IsNotNull(lastEvent); Assert.IsTrue(lastEvent.EventDetail.StartsWith("The game has ended, all Survivors died")); }
public void RecordGameLevelUp() { var game = new Game(); var John = new Survivor("John", 6); var Whaley = new Survivor("Whaley", 4); game.AddSurvivorToGame(John); game.AddSurvivorToGame(Whaley); var gameLevelBefore = game.Level; John.KilledZombie(); var newGameLevel = game.Level; game.RecordAnyGameLevelChange(gameLevelBefore); var lastEvent = game.GameHistory.LastOrDefault(); Assert.IsNotNull(lastEvent); Assert.IsTrue(lastEvent.EventDetail.StartsWith($"The game level is now {newGameLevel}!")); }