public void TestCellBackgroundIsChangedWhenProtected()
        {
            MainWindow window = new MainWindow();
            MinesweeperGrid minesweeperGrid =
                (MinesweeperGrid)MinesweeperGridFactory.CreateNewTable(MinesweeperDifficultyType.Easy);
            PrivateObject view = new PrivateObject(new WpfView(window.WinesweeperGrid));
            Grid buttons = (Grid)view.GetField("win");

            view.Invoke("DisplayGrid", minesweeperGrid);

            int counter = 0;
            for (int r = 0; r < minesweeperGrid.Rows; r++)
            {
                for (int c = 0; c < minesweeperGrid.Cols; c++)
                {
                    if (minesweeperGrid.HasCellBomb(r, c))
                    {
                        minesweeperGrid.ProtectCell(r, c);
                        view.Invoke("DisplayGrid", minesweeperGrid);
                        r = minesweeperGrid.Rows;
                        break;
                    }

                    counter++;
                }
            }

            List<ImageBrush> images = (List<ImageBrush>)view.GetField("images");
            Button button = (Button)buttons.Children[counter];

            Assert.AreEqual(images[1], button.Background);
        }
        public void TestDefaultMainWindowCreatesNewEasyGame()
        {
            var mainWindow = new MainWindow();

            Assert.AreEqual(240, mainWindow.Width);
            Assert.AreEqual(340, mainWindow.Height);
        }
        public void TestNewMediumGameCreation()
        {
            var mainWindow = new MainWindow();
            mainWindow.StartMedium.RaiseEvent(new System.Windows.RoutedEventArgs(MenuItem.ClickEvent));

            Assert.AreEqual(380, mainWindow.Width);
            Assert.AreEqual(480, mainWindow.Height);
        }
        public void TestGameOverShouldBeShown()
        {
            MainWindow mainWindow = new MainWindow();
            WpfView view = new WpfView(mainWindow.WinesweeperGrid);

            view.DisplayGameOver(false);
            view.DisplayGameOver(true);
        }
        public void TestColorIsChangedToGreenWhenCellHasTwoNeighoubringMines()
        {
            MainWindow window = new MainWindow();
            MinesweeperGrid minesweeperGrid =
                (MinesweeperGrid)MinesweeperGridFactory.CreateNewTable(MinesweeperDifficultyType.Hard);
            PrivateObject view = new PrivateObject(new WpfView(window.WinesweeperGrid));
            Grid buttons = (Grid)view.GetField("win");

            view.Invoke("DisplayGrid", minesweeperGrid);

            int counter = 0;
            for (int r = 0; r < minesweeperGrid.Rows; r++)
            {
                for (int c = 0; c < minesweeperGrid.Cols; c++)
                {
                    if (minesweeperGrid.NeighborMinesCount(r, c) == 2)
                    {
                        minesweeperGrid.RevealCell(r, c);
                        view.Invoke("DisplayGrid", minesweeperGrid);

                        r = minesweeperGrid.Rows;
                        break;
                    }

                    counter++;
                }
            }

            Button button = (Button)buttons.Children[counter];

            Color color = Colors.Green;
            SolidColorBrush buttonColorBrush = (SolidColorBrush)button.Foreground;
            var buttonColor = buttonColorBrush.Color;

            //Assert.AreEqual(color, buttonColor);
        }
        public void TestMainWindowCreation()
        {
            var mainWindow = new MainWindow();

            Assert.AreNotEqual(null, mainWindow, "Main window created successfully");
        }