ConsoleApp1/Helpers/UserInputValidator.cs
/// <summary>
/// Check if input parameter is int and also in range between 1 and 9
/// </summary>
/// <param name="inputValue"></param>
/// <returns></returns>
Check if input parameter is int and also in range between 1 and 9
Check if input parameter is int and also in range between 1 and 9
public static ValidationOutcome RangeValidate(string inputValue)
        {
            if (!int.TryParse(inputValue, out int jokeNumbers))
            {
                return ValidationOutcome.ValidationInvalidInputGeneric;
            }
            return jokeNumbers <= JokesMaxNumber && jokeNumbers >= JokesMinNumber ? ValidationOutcome.ValidationSuccess 
                : ValidationOutcome.ValidationOutOfRange;
        }
public static ValidationOutcome RangeValidate ( string inputValue ) { if ( ! int . TryParse ( inputValue , out int jokeNumbers ) ) { return ValidationOutcome . ValidationInvalidInputGeneric ; } return jokeNumbers <= JokesMaxNumber && jokeNumbers >= JokesMinNumber ? ValidationOutcome . ValidationSuccess : ValidationOutcome . ValidationOutOfRange ; }
Check if input parameter is int and also in range between 1 and 9
Check if input parameter is int and also in range between 1 and 9
None
inputValue
string
None