コード例 #1
0
 public void TestConsoleInterfaceShowMessageWithNullParameter()
 {
     var consoleInterface = new ConsoleInterface();
     var output = new StringWriter();
     Console.SetOut(output);
     consoleInterface.ShowMessage(null);
     Assert.AreEqual("\r\n", output.ToString());
 }
コード例 #2
0
 public void TestConsoleInterfaceShowMessage()
 {
     var consoleInterface = new ConsoleInterface();
     string message = "This is the message";
     var output = new StringWriter();
     Console.SetOut(output);
     consoleInterface.ShowMessage(message);
     Assert.AreEqual(message + "\r\n", output.ToString());
 }
コード例 #3
0
 public void TestConsoleInterfaceShowWelcomeMessage()
 {
     var consoleInterface = new ConsoleInterface();
     string expected = "Welcome to the game “Minesweeper”. Try to reveal all cells without mines.\r\n" +
                       "Use 'top' to view the scoreboard, 'restart' to start a new game and 'exit' to quit the game.\r\n\r\n";
     var output = new StringWriter();
     Console.SetOut(output);
     consoleInterface.ShowWelcomeScreen();
     Assert.AreEqual(expected, output.ToString());
 }
コード例 #4
0
 public void TestConsoleInterfaceConstructorWithoutParameterInitializesAllWhiteSkin()
 {
     var consoleInterface = new ConsoleInterface();
     var skin = typeof(ConsoleInterface).GetField("skin", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(consoleInterface);
     Assert.IsInstanceOfType(skin, typeof(AllWhiteSkin));
 }
コード例 #5
0
 public void TestConsoleInterfaceConstructorWithBrightSkinParameter()
 {
     var consoleInterface = new ConsoleInterface(new BrightSkin());
     var skin = typeof(ConsoleInterface).GetField("skin", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(consoleInterface);
     Assert.IsInstanceOfType(skin, typeof(BrightSkin));
 }