Exemplo n.º 1
0
            public void Test1MoveThree()
            {
                // Arrange
                var boardInitializer = new TestBoardInitializer1();
                var game             = new Minesweeper(2, 8, 1, boardInitializer);

                game.Click(0, 0);
                game.Click(0, 7);

                // Act
                var wonGame = game.Click(1, 4);

                // Assert
                Assert.True(wonGame);

                // check that cells are uncovered
                Assert.AreEqual(1, game.Grid[0][0][0]);
                Assert.AreEqual(1, game.Grid[0][1][0]);
                Assert.AreEqual(1, game.Grid[0][2][0]);
                Assert.AreEqual(1, game.Grid[0][3][0]);
                Assert.AreEqual(0, game.Grid[0][4][0]);
                Assert.AreEqual(1, game.Grid[0][5][0]);
                Assert.AreEqual(1, game.Grid[0][6][0]);
                Assert.AreEqual(1, game.Grid[0][7][0]);

                Assert.AreEqual(1, game.Grid[1][0][0]);
                Assert.AreEqual(1, game.Grid[1][1][0]);
                Assert.AreEqual(1, game.Grid[1][2][0]);
                Assert.AreEqual(1, game.Grid[1][3][0]);
                Assert.AreEqual(1, game.Grid[1][4][0]);
                Assert.AreEqual(1, game.Grid[1][5][0]);
                Assert.AreEqual(1, game.Grid[1][6][0]);
                Assert.AreEqual(1, game.Grid[1][7][0]);
            }
Exemplo n.º 2
0
            public void TestFail()
            {
                // Arrange
                var boardInitializer = new TestBoardInitializer1();
                var game             = new Minesweeper(2, 8, 1, boardInitializer);

                // Act
                var wonGame = game.Click(0, 4);

                // Assert
                Assert.False(wonGame);
            }