Example #1
0
        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.");
        }
Example #2
0
        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.");
        }
Example #3
0
        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);
 }
Example #5
0
        public void TestIOHandlerInitialization()
        {
            var ioHandler = new InputOutputHandler(Console.In, Console.Out);

            Assert.IsNotNull(ioHandler, "Incorrect InputOutputHander initialization.");
        }