public void ShouldProvideABoardToPlayTheGame() { board = new Board(9); var moqBoardGenerator = createMock(); var controller = new GameController(moqBoardGenerator.Object); var result = controller.Index() as ViewResult; Assert.IsNotNull(result.Model); moqBoardGenerator.Verify(); }
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); }
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); }