public ChessboardPosition MovedBy(PositionChange positionChange) { if (!CanMoveBy(positionChange)) { throw new DomainConstraintViolationException( $"A move by [{positionChange.X}, {positionChange.Y}] is not allowed from the position [{X}, {Y}"); } return(new ChessboardPosition(X + positionChange.X, Y + positionChange.Y)); }
public bool CanMoveBy(PositionChange positionChange) { return(IsValidPosition(X + positionChange.X, Y + positionChange.Y)); }