Пример #1
0
        public void CheckIfCountRemainingMinesGivesANumberThatIsNotZeroAtTheStartOfTheGame()
        {
            var testFieldSize = 9;
            var field = new Field(testFieldSize);

            field.GenerateField();
            field.PositionMines();

            var countMines = 0;

            for (int i = 0; i < testFieldSize; i++)
            {
                for (int j = 0; j < testFieldSize; j++)
                {
                    if (field.FieldPositions[i, j] is Mine)
                    {
                        countMines++;
                    }
                }
            }

            Assert.AreNotEqual(field.CountRemainingMines(), 0);
        }
Пример #2
0
        public void CheckIfValidateMovieCoordinatesReturnsCorrectly_ValidCoordinates()
        {
            var testFieldSize = 9;
            var field = new Field(testFieldSize);

            field.GenerateField();
            field.PositionMines();

            Coordinates mineCell = new Coordinates();

            for (int i = 0; i < testFieldSize; i++)
            {
                for (int j = 0; j < testFieldSize; j++)
                {
                    if (field.FieldPositions[i, j] is Mine)
                    {
                        mineCell = new Coordinates(i, j);
                    }
                }
            }

            Assert.IsTrue(field.ValidateMoveCoordinates(mineCell));
        }
Пример #3
0
        public void CheckIfPositionMinesMethodPositionsAtLeastOneMine()
        {
            var testFieldSize = 9;
            var field = new Field(testFieldSize);

            field.GenerateField();
            field.PositionMines();

            var countMines = 0;

            for (int i = 0; i < testFieldSize; i++)
            {
                for (int j = 0; j < testFieldSize; j++)
                {
                    if (field.FieldPositions[i, j] is Mine)
                    {
                        countMines++;
                    }
                }
            }

            Assert.AreNotEqual(countMines, 0);
        }