public void Allow_You_To_Take_One_Object_From_a_Pile() { //arrange var game = new NimGame(GameDifficulty.Easy); var ids = game.GetPileIDs(); var amountTaking = -10; bool result; //act result = game.TakeFromPile(ids[0], amountTaking); //assert Assert.IsFalse(result); }
public void Not_Allow_You_To_Take_More_Objects_Then_Present_In_a_Pile() { //arrange var game = new NimGame(GameDifficulty.Easy); var ids = game.GetPileIDs(); var amountTaking = game.GetPileSize(ids[0]) + 1; bool result; //act result = game.TakeFromPile(ids[0], amountTaking); //assert Assert.IsFalse(result); }
public void Allow_You_To_Take_The_Same_Number_Of_Objects_Present_In_a_Pile() { //arrange var game = new NimGame(GameDifficulty.Easy); var ids = game.GetPileIDs(); var amountTaking = game.GetPileSize(ids[0]); bool result; //act result = game.TakeFromPile(ids[0], amountTaking); //assert Assert.IsTrue(result); }
public void Reset_To_Original_State_After_ResetGame_Is_Called() { //arrange var game = new NimGame(GameDifficulty.Easy); var ids = game.GetPileIDs(); var amountTaking = game.GetPileSize(ids[0]); var expectedConfiguration = new [] { 3, 3 }; //act game.TakeFromPile(ids[0], amountTaking); game.ResetGame(); //assert for (int i = 0; i < expectedConfiguration.Length; i++) { Assert.AreEqual(expectedConfiguration[i], game.GetPileSize(ids[i])); } }
public void Fire_Game_Over_When_All_Piles_Are_Empty() { //arrange var game = new NimGame(GameDifficulty.Hard); bool gameIsOver = false; game.GameOver += (s, e) => gameIsOver = true; //act foreach (var pileID in game.GetPileIDs()) { game.TakeFromPile(pileID, game.GetPileSize(pileID)); } //assert if (!gameIsOver) { Assert.Fail(); } }