public void FullSinglerPlayerGame_FailingOnThirdLevel() { var gameBoard = new GameBoard(); var player = new Player {Id = 1, Name = "Derik"}; gameBoard.SetupBoard(new List<Player>{player}, DifficultyLevel.Easy); // setup the board for the first move var moveList = gameBoard.GetMoveList(player); var moveResult = gameBoard.HandleMove(player, moveList.Last()); Assert.AreEqual(AttemptResult.Valid, moveResult); // setup for next move moveList = gameBoard.GetMoveList(player); moveResult = gameBoard.HandleMove(player, moveList.Last()); Assert.AreEqual(AttemptResult.Valid, moveResult); // setup for next move moveList = gameBoard.GetMoveList(player); moveResult = gameBoard.HandleMove(player, moveList.Last()); Assert.AreEqual(AttemptResult.Valid, moveResult); }
public void SetupBoard_WhenOnePlayer_WillSetupBoardCorrectly() { var gameBoard = new GameBoard(); gameBoard.SetupBoard(new List<Player>{new Player{Id = 1}}, DifficultyLevel.Easy); Assert.AreEqual(1, gameBoard.Players.Count); }
public void HandleMove_WhenMoveValid_WillReturnCorrectResult() { var player = new Player { Id = 1 }; var gameBoard = new GameBoard(); gameBoard.SetupBoard(new List<Player> { player }, DifficultyLevel.Medium); var moveList = gameBoard.GetMoveList(player); var moveResult = gameBoard.HandleMove(player, moveList.Last()); Assert.AreEqual(AttemptResult.Valid, moveResult); }
public void HandleMove_WhenPlayerNotInList_WillThrowExeption() { var player = new Player {Id = 1}; var badPlayer = new Player { Id = 2 }; var gameBoard = new GameBoard(); gameBoard.SetupBoard(new List<Player>{player}, DifficultyLevel.Medium); try { gameBoard.HandleMove(badPlayer, GameTile.BottomRight); } catch (Exception e) { // all good return; } Assert.Fail("Should have had an exception thrown"); }
public void SetupBoard_WillSetThe_DifficultyLevelCorrectly() { var gameBoard = new GameBoard(); gameBoard.SetupBoard(new List<Player> { new Player { Id = 1 }, new Player { Id = 2 } }, DifficultyLevel.Easy); Assert.AreEqual(DifficultyLevel.Easy, gameBoard.CurrentDifficultyLevel); }