public void Into_ShouldWriteInto() { string rn = Environment.NewLine; //Arrange CellCollection cellCollection = new CellCollection(new ICell[] { new UnselectedCell(new Glyph('0')), new UnselectedCell(new Glyph('1')), new UnselectedCell(new Glyph('2')), new UnselectedCell(new Glyph('3')), new UnselectedCell(new Glyph('4')), new UnselectedCell(new Glyph('5')), new UnselectedCell(new Glyph('6')), new UnselectedCell(new Glyph('7')), new UnselectedCell(new Glyph('8')) }); FakeWriter fakeWriter = new FakeWriter(); BoardPrinter subject = new BoardPrinter(cellCollection, fakeWriter); //Act subject.Print(); //Assert fakeWriter.AssertLinesWritten($" 0 | 1 | 2{rn}===+===+==={rn} 3 | 4 | 5{rn}===+===+==={rn} 6 | 7 | 8{rn}"); }
public void ShouldDisplayWelcome() { //Arrange FakeWriter fakeWriter = new FakeWriter(); ConsoleGameStarting subject = new ConsoleGameStarting(fakeWriter); //Act subject.DisplayWelcome(); //Assert fakeWriter.AssertLinesWritten("Welcome to Tic-Tac-Toe!"); }
public void ShouldPrintOutGameOverAndWaitForInput() { //Arrange FakeWriter fakeWriter = new FakeWriter(); FakeReader fakeReader = new FakeReader(Environment.NewLine); ConsoleGameEnding subject = new ConsoleGameEnding(fakeReader, fakeWriter); //Act subject.Display(); //Assert fakeWriter.AssertLinesWritten("Game over", "Press Enter to Exit"); fakeReader.AssertReadLineInvoked(); }
public void Input_ShouldWritePrompt() { //Arrange FakeCell fakeCell = new FakeCell.Builder().Value("?").Build(); FakeValidResponse <IGlyph> fakeValidResponse = new FakeValidResponse <IGlyph> .Builder().Response(null).Build(); FakeWriter fakeWriter = new FakeWriter(); HumanMoveInput subject = new HumanMoveInput(fakeValidResponse, fakeWriter); //Act subject.Input(fakeCell); //Assert fakeWriter.AssertLinesWritten("Player ?'s Turn"); }