Esempio n. 1
0
        public void ReturnZeroWhenThereIsNoBombSurrounding()
        {
            var surroundingChecker = new SurroundingChecker();
            var field = new Field()
            {
                NoOfRows    = 4,
                NoOfColumns = 5,
                Value       = "*...." +
                              "....." +
                              ".*..." +
                              "....."
            };
            var square = new Square
            {
                XCoordinate = 3,
                YCoordinate = 4,
                IsBomb      = false,
            };

            var actual   = surroundingChecker.CheckBomb(square, field);
            var expected = "1";

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void ReturnNoOfBombsSurroundingSquare()
        {
            var surroundingChecker = new SurroundingChecker();
            var field = new Field()
            {
                NoOfRows    = 4,
                NoOfColumns = 4,
                Value       = "*..." +
                              "...." +
                              ".*.." +
                              "...."
            };
            var square = new Square
            {
                XCoordinate = 2,
                YCoordinate = 2,
                IsBomb      = false,
            };

            var actual   = surroundingChecker.CheckBomb(square, field);
            var expected = "2";

            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void ReturnBombSymbolIfSquareContainsBomb()
        {
            var surroundingChecker = new SurroundingChecker();
            var field = new Field()
            {
                NoOfRows    = 4,
                NoOfColumns = 4,
                Value       = "*..." +
                              "...." +
                              "...." +
                              ".*.."
            };
            var square = new Square
            {
                XCoordinate = 4,
                YCoordinate = 2,
                IsBomb      = true,
            };

            var actual   = surroundingChecker.CheckBomb(square, field);
            var expected = "*";

            Assert.AreEqual(expected, actual);
        }