public void TestConsoleInterfaceShowMessageWithNullParameter() { var consoleInterface = new ConsoleInterface(); var output = new StringWriter(); Console.SetOut(output); consoleInterface.ShowMessage(null); Assert.AreEqual("\r\n", output.ToString()); }
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()); }
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()); }
public void TestConsoleInterfaceConstructorWithoutParameterInitializesAllWhiteSkin() { var consoleInterface = new ConsoleInterface(); var skin = typeof(ConsoleInterface).GetField("skin", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(consoleInterface); Assert.IsInstanceOfType(skin, typeof(AllWhiteSkin)); }
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)); }