Example #1
0
 public void TestIfResetMethodCorrectlyResetsTheUserMovesCount()
 {
     var gameModel = new Game(new GameLogic(MatrixValidator.GetInstance));
     gameModel.IncrementMoves();
     gameModel.Reset();
     Assert.AreEqual(0, gameModel.UserMovesCount);
 }
Example #2
0
        public void TestIfResetMethodResetsTheGameFieldCorrectly()
        {
            var gameModel = new Game(new GameLogic(MatrixValidator.GetInstance));
            var fieldBeforeReset = (byte[,])gameModel.Field.Clone();
            gameModel.Reset();

            var differentFieldCount = 0;

            for (int i = 0; i < fieldBeforeReset.GetLength(0); i++)
            {
                for (int j = 0; j < fieldBeforeReset.GetLength(1); j++)
                {
                    if (fieldBeforeReset[i, j] != gameModel.Field[i, j])
                    {
                        differentFieldCount++;
                    }
                }
            }

            Assert.IsTrue(gameModel.Field.Length / differentFieldCount < 2);
        }