public void Game_FullRound() { Profile player1 = new Profile(); Profile player2 = new Profile(); Profile player3 = new Profile(); Profile player4 = new Profile(); ColorettoGame target = new ColorettoGame(player1, player2, player3, player4); // Loop through 5 times. // There are 76 cards. The last cycle card should be the 61st. // Each cycle, which is in this for loop, uses 12 cards. // 12 * 5 = 60 cards. So, the next cycle will be in the 6th loop for (int i = 0; i < 6; i++) { if (i == 5) { Assert.AreEqual<int>(1, target.Round); } target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(0); if (i == 5) { Assert.AreEqual<int>(1, target.Round); Assert.IsTrue(target.IsLastCycleForRound); } target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(1); target = target.DrawCard(); target = target.PlaceCardOnPile(1); target = target.DrawCard(); target = target.PlaceCardOnPile(1); target = target.DrawCard(); target = target.PlaceCardOnPile(2); target = target.DrawCard(); target = target.PlaceCardOnPile(2); target = target.DrawCard(); target = target.PlaceCardOnPile(2); target = target.DrawCard(); target = target.PlaceCardOnPile(3); target = target.DrawCard(); target = target.PlaceCardOnPile(3); target = target.DrawCard(); target = target.PlaceCardOnPile(3); target = target.PickupPile(0); target = target.PickupPile(1); target = target.PickupPile(2); target = target.PickupPile(3); if (i == 5) { Assert.AreEqual<int>(2, target.Round); } } }
public void Game_PickupPileTest() { Profile player1 = new Profile(); Profile player2 = new Profile(); Profile player3 = new Profile(); Profile player4 = new Profile(); ColorettoGame target = new ColorettoGame(player1, player2, player3, player4); target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(0); int numberOfPlayersWithNonZeroScore = target.Hands.Where(cc => cc.Score > 0).Count(); Assert.IsTrue(numberOfPlayersWithNonZeroScore == 0, "Somehow someone started with a non-zero score."); target = target.PickupPile(0); CardCollection nullPileBecauseItWasPickedUp = target.Piles.First(); Assert.IsNull(nullPileBecauseItWasPickedUp); numberOfPlayersWithNonZeroScore = target.Hands.Where(cc => cc.Score > 0).Count(); Assert.IsTrue(numberOfPlayersWithNonZeroScore > 0, "Someone picked up a pile but nobody has a non-zero score"); }
public void Game_FullCycle() { Profile player1 = new Profile(); Profile player2 = new Profile(); Profile player3 = new Profile(); Profile player4 = new Profile(); ColorettoGame target = new ColorettoGame(player1, player2, player3, player4); target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(0); target = target.DrawCard(); target = target.PlaceCardOnPile(1); target = target.DrawCard(); target = target.PlaceCardOnPile(1); target = target.DrawCard(); target = target.PlaceCardOnPile(1); target = target.DrawCard(); target = target.PlaceCardOnPile(2); target = target.DrawCard(); target = target.PlaceCardOnPile(2); target = target.DrawCard(); target = target.PlaceCardOnPile(2); target = target.DrawCard(); target = target.PlaceCardOnPile(3); target = target.DrawCard(); target = target.PlaceCardOnPile(3); target = target.DrawCard(); target = target.PlaceCardOnPile(3); Assert.AreEqual<int>(1, target.Cycle); Assert.AreEqual<int>(13, target.Turn); Assert.AreEqual<GameActions>(GameActions.PickupPile, target.AvailableActions); target = target.PickupPile(0); target = target.PickupPile(1); target = target.PickupPile(2); target = target.PickupPile(3); // Make sure that a new cycle is created Assert.AreEqual<int>(2, target.Cycle); Assert.AreEqual<int>(17, target.Turn); Assert.AreEqual<GameActions>(GameActions.Draw, target.AvailableActions); }