public void ThenAllTheTilesShouldBeRevealed()
        {
            var tiles = GamePlayPage.get_all_tiles();

            foreach (var tile in tiles)
            {
                Assert.That(tile.is_empty(), Is.True);
            }
        }
Example #2
0
 public void StartGame()
 {
     if (Player != null)
     {
         CreateGame();
         Level level = Level;
         var   page  = new GamePlayPage(Player, level);
         ((MainWindow)Application.Current.MainWindow).Main.Content = page;
     }
 }
        public void ThenTheFollowingTilesShouldNotBeRevealed(Table table)
        {
            var tiles = GamePlayPage.get_all_tiles();

            foreach (var tiles_to_find in table.Rows)
            {
                var tile = new { row = int.Parse(tiles_to_find["Row"]), col = int.Parse(tiles_to_find["Column"]) };

                Assert.That(tiles.First(x => x.row == tile.row && x.column == tile.col).is_unrevealed(), Is.True);
            }
        }
        public void ThenIShouldSeeAMinefieldFullOfTiles(int row, int cols)
        {
            var total_number_of_tiles = row * cols;

            var tiles = GamePlayPage.get_all_tiles();

            Assert.That(tiles.Count(), Is.EqualTo(total_number_of_tiles));

            foreach (var tile in tiles)
            {
                Assert.That(tile.is_unrevealed(), Is.True);
            }
        }
        public void ThenTheFollowingTilesShouldBeRevealed(Table table)
        {
            var tiles = GamePlayPage.get_all_tiles();

            // TODO: Map the table automatically

            foreach (var tiles_to_find in table.Rows)
            {
                var tile = new { row = int.Parse(tiles_to_find["Row"]), col = int.Parse(tiles_to_find["Column"]), number_of_mines_surrounding_by = int.Parse(tiles_to_find["NumberOfMinesSurroundedBy"]) };

                Assert.That(tiles.First(x => x.row == tile.row && x.column == tile.col).is_revealed(), Is.True);
                Assert.That(tiles.First(x => x.row == tile.row && x.column == tile.col).number_of_mines_surrounding_by(), Is.EqualTo(tile.number_of_mines_surrounding_by));
            }
        }
 public void WhenIClickOnTheTileAtCoordinate(int col, int row)
 {
     GamePlayPage.click_tile_at(col, row);
 }
Example #7
0
        public void ReloadGamePlayPage()
        {
            var page = new GamePlayPage(player, level);

            ((MainWindow)Application.Current.MainWindow).Main.Content = page;
        }