public void PlayerCanNotPlaceNewTroopsOnUnheldCountry() { Player otherPlayer = new Player() { Game = game }; game.players.Add(otherPlayer); Assert.AreNotEqual(otherPlayer, game.countries[0].PlayerOccupying); Country country = game.countries[0]; int originalValue = country.TroopOccupyCount; int troopsToPlace = 3; bool exceptionThrown = false; var troopPlacer = TroopPlacerFactory.Create(otherPlayer); try { troopPlacer.PlaceTroop(country, troopsToPlace); } catch { exceptionThrown = true; } Assert.IsTrue(exceptionThrown); Assert.AreNotEqual(originalValue + troopsToPlace, country.TroopOccupyCount); }
public void PlayerCanPlaceNewTroopsOnHeldCountry() { Player player = game.players[0]; Country country = game.countries[0]; Assert.AreEqual(player, game.countries[0].PlayerOccupying); int originalValue = country.TroopOccupyCount; int troopsToPlace = 3; var troopPlacer = TroopPlacerFactory.Create(player); troopPlacer.PlaceTroop(country, troopsToPlace); Assert.AreEqual(originalValue + troopsToPlace, country.TroopOccupyCount); }