Ejemplo n.º 1
0
        public void Edges()
        {
            int size = 3;
            Board board = new Board(size);
            board.Click(0, 1);
            Assert.AreEqual(board.GetCellAt(0, 0).State, true);
            Assert.AreEqual(board.GetCellAt(0, 1).State, true);
            Assert.AreEqual(board.GetCellAt(0, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(1, 0).State, false);
            Assert.AreEqual(board.GetCellAt(1, 2).State, false);
            Assert.AreEqual(board.GetCellAt(2, 1).State, false);

            board = new Board(size);
            board.Click(1, 0);
            Assert.AreEqual(board.GetCellAt(0, 0).State, true);
            Assert.AreEqual(board.GetCellAt(2, 0).State, true);
            Assert.AreEqual(board.GetCellAt(1, 0).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(0, 1).State, false);
            Assert.AreEqual(board.GetCellAt(2, 1).State, false);
            Assert.AreEqual(board.GetCellAt(1, 2).State, false);

            board = new Board(size);
            board.Click(1, 2);
            Assert.AreEqual(board.GetCellAt(0, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 2).State, true);
            Assert.AreEqual(board.GetCellAt(2, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(0, 1).State, false);
            Assert.AreEqual(board.GetCellAt(1, 0).State, false);
            Assert.AreEqual(board.GetCellAt(2, 1).State, false);

            board = new Board(size);
            board.Click(2, 1);
            Assert.AreEqual(board.GetCellAt(2, 0).State, true);
            Assert.AreEqual(board.GetCellAt(2, 1).State, true);
            Assert.AreEqual(board.GetCellAt(2, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(1, 0).State, false);
            Assert.AreEqual(board.GetCellAt(0, 1).State, false);
            Assert.AreEqual(board.GetCellAt(1, 2).State, false);
        }
Ejemplo n.º 2
0
 public void Middle()
 {
     int size = 3;
     var board = new Board(size);
     board.Click(1, 1);
     Assert.AreEqual(board.GetCellAt(1, 1).State, true);
     Assert.AreEqual(board.GetCellAt(0, 1).State, true);
     Assert.AreEqual(board.GetCellAt(1, 0).State, true);
     Assert.AreEqual(board.GetCellAt(2, 1).State, true);
     Assert.AreEqual(board.GetCellAt(1, 2).State, true);
     Assert.AreEqual(board.GetCellAt(2, 0).State, false);
     Assert.AreEqual(board.GetCellAt(0, 2).State, false);
     Assert.AreEqual(board.GetCellAt(0, 0).State, false);
     Assert.AreEqual(board.GetCellAt(2, 2).State, false);
 }