public void Main_Input10_ProgramDoesNotExit() { const string expected = ""; ConsoleAssert.Expect( expected, () => Program.Main("10")); }
public void Main_Input5_AnswerTooLow() { const string expected = @"Tic-tac-toe has more than 5 maximum turns."; ConsoleAssert.Expect( expected, () => Program.Main("5")); }
public void Main_Input8_ExitProgram() { const string expected = @"Exiting"; ConsoleAssert.Expect( expected, () => Program.Main("8")); }
public void Main_Input9_CorrectAnswer() { const string expected = @"Correct, tic-tac-toe has a maximum of 9 turns."; ConsoleAssert.Expect( expected, () => Program.Main("9")); }
public void MainRunsEventManager() { ConsoleAssert.Expect(@"What do you want to do? 1. Create a course 2. Create an event 3. List events 4. Exit<<4", Program.Main); }
public void Main_InputOfNegative1_Exit() { const string expected = @"Exiting..."; ConsoleAssert.Expect( expected, () => Program.Main("-1")); }
public void Main_Input10_AnswerTooHigh() { const string expected = @"Tic-tac-toe has less than 10 maximum turns."; ConsoleAssert.Expect( expected, () => Program.Main("10")); }
public void ConsoleTester_StringWithVT100Characters_VT100Stripped(string input, string expected, bool stripVT100) { ConsoleAssert.Expect(expected, () => { System.Console.WriteLine(input); }); }
public void ConsoleTester_HelloWorld_NoInput() { const string view = "Hello World"; ConsoleAssert.Expect(view, () => { System.Console.Write("Hello World"); }, NormalizeOptions.None); }
public void ConsoleTester_HelloWorld_TrimCRLF() { const string view = "Hello World"; ConsoleAssert.Expect(view, () => { System.Console.Write("Hello World"); }); }
public void ConsoleTester_HelloWorld_TrimLF() { string view = "Hello World\n"; ConsoleAssert.Expect(view, () => { System.Console.WriteLine("Hello World"); }, true); }
public void ConsoleTester_HelloWorld_NoInput() { string view = @"Hello World"; ConsoleAssert.Expect(view, () => { System.Console.Write("Hello World"); }); }
public void ConsoleTester_ExplicitStrippingExplicitly_VT100Stripped() { string input = "\u001b[49mMontoya"; string expected = "Montoya"; ConsoleAssert.Expect(expected, () => { System.Console.Write(input); }, NormalizeOptions.StripAnsiEscapeCodes); }
public void ConsoleTester_HelloWorld_MissingNewline() { const string view = @"Hello World "; ConsoleAssert.Expect(view, () => { System.Console.WriteLine("Hello World"); }, NormalizeOptions.None); }
public void ConsoleTester_OutputIncludesPluses_PlusesAreNotStripped(string consoleInput) { Exception exception = Assert.ThrowsException <Exception>(() => { ConsoleAssert.Expect(consoleInput, () => { System.Console.Write(""); // Always fail }, NormalizeOptions.None); }); StringAssert.Contains(exception.Message, consoleInput); }
public void Main_InputOfNegative1_Exit() { Program.input = -1; const string expected = @"Exiting..."; ConsoleAssert.Expect( expected, Program.Main); }
public void Main_Input8_ExitProgram() { Program.input = 8; const string expected = @"Exiting"; ConsoleAssert.Expect( expected, Program.Main); }
public void Main_Input10_ProgramDoesNotExit() { Program.input = 10; const string expected = ""; ConsoleAssert.Expect( expected, Program.Main); }
public void ConsoleTester_HelloWorld_MissingNewline() { string view = @"Hello World "; ConsoleAssert.Expect(view, () => { System.Console.WriteLine("Hello World"); }); }
public void Main_Enter1TryToPlayAgainstComputer_ComputerPathSelected() { const string expected = @"1 - Play against the computer 2 - Play against another player. Choose:<<1 >>Play against computer selected."; ConsoleAssert.Expect( expected, TicTacToe.Main); }
public void Main_EnterOther_TwoPlayerPathSelected() { const string expected = @"1 - Play against the computer 2 - Play against another player. Choose:<<9 >>Play against another player."; ConsoleAssert.Expect( expected, TicTacToe.Main); }
public void ConsoleTester_HelloWorld_DontNormalizeCRLF() { const string view = "Hello World\r\n"; Assert.ThrowsException <Exception>(() => { ConsoleAssert.Expect(view, () => { System.Console.Write("Hello World\r"); }, NormalizeOptions.None); }); }
public void GivenStringLiteral_ExpectedOutputNormalized_OutputMatches() { const string view = @"Begin Middle End"; ConsoleAssert.Expect(view, () => { System.Console.WriteLine("Begin"); System.Console.WriteLine("Middle"); System.Console.WriteLine("End"); }); }
public void Main_HospitalEmergencyCodes_DisplaysCodes() { const string expected = @"info: Console[0] Hospital Emergency Codes: = 'black', 'blue', 'brown', 'CBR', 'orange', 'purple', 'red', 'yellow' warn: Console[0] This is a test of the emergency... "; ConsoleAssert.Expect(expected, () => Program.Main(new[] { "black", "blue", "brown", "CBR", "orange", "purple", "red", "yellow" })); }
public void ConsoleTester_Sample_InigoMontoya() { const string view = @"First name: <<Inigo >>Last name: <<Montoya >>Hello, Inigo Montoya."; ConsoleAssert.Expect(view, () => { System.Console.Write("First name: "); string fname = System.Console.ReadLine(); System.Console.Write("Last name: "); string lname = System.Console.ReadLine(); System.Console.Write("Hello, {0} {1}.", fname, lname); }); }
public void WriteLine_OutputsLineOnTheConsole() { var console = new RealConsole(); ConsoleAssert.Expect(">>Output line", () => console.WriteLine("Output line")); }
public void ReadLine_ReadsLineFromConsole() { var console = new RealConsole(); ConsoleAssert.Expect("<<Testing line", () => console.ReadLine()); }