コード例 #1
0
        //[TestProperty("MiddleSquareTestingWithoutMines", "0")]
        public void GetLocationValue_SquareInMiddleWithoutMines_Success()
        {
            int[,] inputBoard = new int[, ] {
                { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { -1, 0, -1 }
            };
            MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard);

            int locationValue = minesweeperSolver.GetLocationValue(1, 1);

            Assert.AreEqual(0, locationValue);
        }
コード例 #2
0
        //[TestProperty("BottomCornerSquareTesting", "1")]
        public void GetLocationValue_BottomCornerSquareWithMine_Success()
        {
            int[,] inputBoard = new int[, ] {
                { -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 0 }
            };
            MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard);

            int locationValue = minesweeperSolver.GetLocationValue(2, 2);

            Assert.AreEqual(1, locationValue);
        }
コード例 #3
0
        //[TestProperty("CornerSquareTesting", "5")]
        public void GetLocationValue_SquareAllSurroundedByMines_Success()
        {
            int[,] inputBoard = new int[, ] {
                { -1, 0, -1 }, { -1, -1, -1 }, { 0, 0, 0 }
            };
            MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard);

            int locationValue = minesweeperSolver.GetLocationValue(0, 1);

            Assert.AreEqual(5, locationValue);
        }
コード例 #4
0
        public void SolveGame_With_Success()
        {
            int[,] inputBoard = new int[, ] {
                { -1, -1, -1, 0, -1 }
            };
            MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard);

            //int locationValue = minesweeperSolver.GetLocationValue(10, 10);

            Assert.Throws <IndexOutOfRangeException>(() => minesweeperSolver.GetLocationValue(10, 10));
        }