public void TestBishopMoveFromInsideTheBoard() { var pos = new Position(2, 5); var bishop = new BishopPiece(1, pos); var moves = new HashSet <Position>(bishop.ValidMovesFor(pos)); Assert.IsNotNull(moves); Assert.AreEqual(9, moves.Count); var possibles = new[] { new Position(1, 4), new Position(3, 6), new Position(4, 7), new Position(5, 8), new Position(1, 6), new Position(3, 4), new Position(4, 3), new Position(5, 2), new Position(6, 1) }; foreach (var possible in possibles) { Assert.IsTrue(moves.Contains(possible)); } }
public void TestBishopMoveFromCorner() { var pos = new Position(1, 1); var bishop = new BishopPiece(1, pos); var moves = new HashSet <Position>(bishop.ValidMovesFor(pos)); Assert.IsNotNull(moves); Assert.AreEqual(7, moves.Count); var possibles = new[] { new Position(2, 2), new Position(3, 3), new Position(4, 4), new Position(5, 5), new Position(6, 6), new Position(7, 7), new Position(8, 8) }; foreach (var possible in possibles) { Assert.IsTrue(moves.Contains(possible)); } }