예제 #1
0
        public void IsOnBoardTrueTest()
        {
            HexBoardNeighbours testBoard = new HexBoardNeighbours(5);

            Assert.IsTrue(testBoard.IsOnBoard(new Location(0, 0)));
            Assert.IsTrue(testBoard.IsOnBoard(new Location(2, 2)));
            Assert.IsTrue(testBoard.IsOnBoard(new Location(0, 4)));
            Assert.IsTrue(testBoard.IsOnBoard(new Location(4, 0)));
            Assert.IsTrue(testBoard.IsOnBoard(new Location(4, 4)));
        }
예제 #2
0
        public void IsOnBoardFalseTest()
        {
            HexBoardNeighbours testBoard = new HexBoardNeighbours(5);

            Assert.IsFalse(testBoard.IsOnBoard(new Location(-1, -1)));
            Assert.IsFalse(testBoard.IsOnBoard(new Location(2, -1)));
            Assert.IsFalse(testBoard.IsOnBoard(new Location(0, 5)));
            Assert.IsFalse(testBoard.IsOnBoard(new Location(5, 0)));
            Assert.IsFalse(testBoard.IsOnBoard(new Location(-1, 5)));
        }
예제 #3
0
        private static void TestOnBoard(HexBoardNeighbours testBoard, Location neighbour)
        {
            Assert.IsTrue(testBoard.IsOnBoard(neighbour));

            Assert.GreaterOrEqual(neighbour.X, 0);
            Assert.GreaterOrEqual(neighbour.Y, 0);

            Assert.Less(neighbour.X, testBoard.BoardSize);
            Assert.Less(neighbour.Y, testBoard.BoardSize);
        }