public IEnumerator FreshersFluCard_DeactivatePunishment_RecalculatesBonusesIfLandmarkCaptured() { //Tests that FreshersFluCard correctly recalculates the bonuses, which can be caused by players capturing landmarks //while the card is active. Setup(); game.InitializeMap(); yield return(null); Player testPlayer = players [0]; Card testCard = new FreshersFluCard(testPlayer); Player player2 = players [1]; int player2InitialKnowledgeBonus = player2.GetKnowledge(); //Create a new landmark sector that will be captured by player2 once the FreshersFluCard is played. Landmark newLandmark = new GameObject("TestLandmark").AddComponent <Landmark> (); newLandmark.SetResourceType(Landmark.ResourceType.Knowledge); player2.ownedSectors [0].GetAdjacentSectors() [0].SetLandmark(newLandmark); testCard.activatePunishment(); player2.Capture(player2.ownedSectors [0].GetAdjacentSectors() [0]); //Capture the new landmark. testCard.deactivatePunishment(); Assert.AreEqual(player2InitialKnowledgeBonus + 2, player2.GetKnowledge()); }
public IEnumerator FreshersFluCard_DeactivatePunishment_ReturnsBonuses() { //Tests that FreshersFluCard correctly restores the bonuses. Setup(); game.InitializeMap(); yield return(null); Player testPlayer = players [0]; Card testCard = new FreshersFluCard(testPlayer); List <int> bonuses = new List <int> (); for (int i = 1; i < 4; i++) { bonuses.Add(players [i].GetBeer()); bonuses.Add(players [i].GetKnowledge()); } testCard.activatePunishment(); //activate the punishment testCard.deactivatePunishment(); //deactivate the punishment //Test that the bonuses have been returned to normal for all "enemy" players. for (int i = 1; i < 4; i++) { Assert.AreEqual(bonuses [0], players [i].GetBeer()); bonuses.Remove(bonuses [0]); Assert.AreEqual(bonuses [0], players [i].GetKnowledge()); bonuses.Remove(bonuses [0]); } }