public void Check(int number) { switch (number.CompareTo(CorrectNumber)) { case 1: _messenger.Deliver(Resources.TooHighMessage); break; case -1: _messenger.Deliver(Resources.TooLowMessage); break; case 0: _messenger.Deliver(Resources.CorrectMessage); IsOver = true; break; default: throw new ArgumentOutOfRangeException(); } }
public void Check(int number) { _logger.Log($"Checking {number}..."); if (!GameService.IsValid(number)) { _logger.Log(Resources.InvalidNumberMessage); _messenger.Deliver(Resources.InvalidNumberMessage); return; } switch (number.CompareTo(CorrectNumber)) { case 1: _logger.Log($"{number} is {Resources.TooHighMessage}"); _messenger.Deliver(Resources.TooHighMessage); break; case -1: _logger.Log($"{number} is {Resources.TooLowMessage}"); _messenger.Deliver(Resources.TooLowMessage); break; case 0: _logger.Log($"{number} is {Resources.CorrectMessage}"); _messenger.Deliver(Resources.CorrectMessage); IsOver = true; break; default: throw new ArgumentOutOfRangeException(); } }