예제 #1
0
        public void ShouldReturnFalseWhenDoesntHaveBomb()
        {
            var moqBoardGenerator = createMock();
            var controller = new GameController(moqBoardGenerator.Object);
            int row = 1;
            int col = 2;
            board = new Board(9);
            var session = new SessionStateItemCollection();
            session["board"] = board;
            controller.ControllerContext = new FakeControllerContext(controller, session);

            var result = controller.HasBomb(row, col);
            Assert.IsFalse((bool)result.Data);
        }
예제 #2
0
        public void ShouldReturnTrueWhenCellHasBomb()
        {
            var session = new SessionStateItemCollection();
            board = new Board(9);
            board.AddBombAt(1, 2);
            session["board"] = board;

            var moqBoardGenerator = createMock();
            var controller = new GameController(moqBoardGenerator.Object);
            controller.ControllerContext = new FakeControllerContext(controller, session);
            int row = 1;
            int col = 2;

            JsonResult result = controller.HasBomb(row, col);
            Assert.IsTrue((bool)result.Data);
        }