Lotto: refactor tests and rule layer