public void TestIOHandlerReadCoordinates() { var ioHandler = new InputOutputHandler(new StringReader("-11\r\n6 8"), Console.Out); var coordinates = ioHandler.ReadCoordinates(); Assert.AreEqual(coordinates.Col, 8, "Incorrect InputOutputHandler ReadCoordinates result."); }
public void TestIOHandlerReadIncorrectBattleFieldSize() { var ioHandler = new InputOutputHandler(new StringReader("-5\r\n4"), Console.Out); var size = ioHandler.ReadBattleFieldSize(); Assert.AreEqual(size, 4, "Incorrect InputOutputHandler ReadBattleFieldSize result."); }
public void TestIOHandlerWriteLine() { var output = new StringBuilder(); var ioHandler = new InputOutputHandler(Console.In, new StringWriter(output)); ioHandler.WriteLine(2); Assert.AreEqual(output.ToString(), "2\r\n", "Incorrect InputOutputHandler WriteLine result."); }
public BattleFieldGame(TextReader reader, TextWriter writer) { this.inputOutputHandler = new InputOutputHandler(reader, writer); }
public void TestIOHandlerInitialization() { var ioHandler = new InputOutputHandler(Console.In, Console.Out); Assert.IsNotNull(ioHandler, "Incorrect InputOutputHander initialization."); }