public void TestPrintExplosionMessage()
 {
     using (ConsoleRedirector cr = new ConsoleRedirector())
     {
         int score = 5;
         Assert.IsFalse(cr.ToString().Contains("\nBooom! You are killed by a mine!You revealed " +
             score + " cells without mines."));
         ioManager.PrintExplosionMessage(score);
         Assert.IsTrue(cr.ToString().Contains("\nBooom! You are killed by a mine!You revealed " +
             score + " cells without mines."));
     }
 }
 public void TestPrintWinnerMessage()
 {
     using (ConsoleRedirector cr = new ConsoleRedirector())
     {
         Assert.IsFalse(cr.ToString().Contains("Congratulations! You are the WINNER!\nPlease enter your name for the top scoreboard: "));
         ioManager.PrintWinnerMessage();
         Assert.IsTrue(cr.ToString().Contains("Congratulations! You are the WINNER!\nPlease enter your name for the top scoreboard: "));
     }
 }
 public void TestPrintInvalidCommandMessage()
 {
     using (ConsoleRedirector cr = new ConsoleRedirector())
     {
         Assert.IsFalse(cr.ToString().Contains("Invalid row/col entered! Try again!"));
         ioManager.PrintInvalidCommandMessage();
         Assert.IsTrue(cr.ToString().Contains("Invalid row/col entered! Try again!"));
     }
 }
 public void TestPrintQuitMessage()
 {
     using (ConsoleRedirector cr = new ConsoleRedirector())
     {
         Assert.IsFalse(cr.ToString().Contains("\nGood bye!\n"));
         ioManager.PrintQuitMessage();
         Assert.IsTrue(cr.ToString().Contains("\nGood bye!\n"));
     }
 }
 public void TestPrintGameFieldNoBoomed()
 {
     using (ConsoleRedirector cr = new ConsoleRedirector())
     {
         Field gameField = new Field();
         bool hasBoomed = false;
         string scoreBoard = @"     0 1 2 3 4 5 6 7 8 9
        ---------------------
     0 |  ? ? ? ? ? ? ? ? ? ?|
     1 |  ? ? ? ? ? ? ? ? ? ?|
     2 |  ? ? ? ? ? ? ? ? ? ?|
     3 |  ? ? ? ? ? ? ? ? ? ?|
     4 |  ? ? ? ? ? ? ? ? ? ?|
        --------------------";
         Assert.IsFalse(cr.ToString().Contains(scoreBoard));
         ioManager.PrintGameField(gameField, hasBoomed);
         Assert.IsTrue(cr.ToString().Contains(scoreBoard));
     }
 }