private bool CheckingValue(string valueToCheck) { return(_validator.CheckValue(checkingValue => { if (checkingValue > MAX_RANGE || checkingValue < MIN_RANGE) { return false; } return true; }, _transformator.ConfirmConversion <int, string>(valueToCheck), false)); }
public void Start(string[] mainArguments) { if ((mainArguments.Length != 3) || !uint.TryParse(mainArguments[0], out _) || !uint.TryParse(mainArguments[1], out _) || !uint.TryParse(mainArguments[2], out _)) { WriteLine("You must enter three values: [min_ticket_value] [max_ticket_value] [ticket_size]\n" + "And all of these have ot be uint"); return; } try { string luckyTicketType = GetLuckyTicketType(); int minTicketValue = GetMaxOrMinValue(mainArguments[0]); int maxTicketValue = GetMaxOrMinValue(mainArguments[1]); int ticketSize = _transformator.ConfirmConversion <int, string>(mainArguments[2]) > TICKET_MAX_SIZE ? _transformator.ConfirmConversion <int, string>(mainArguments[2]) : TICKET_MAX_SIZE; Controller ticketController = GetController(maxTicketValue, minTicketValue, ticketSize, luckyTicketType); ticketController.SetModel(); ticketController.Display(); } catch (Exception ex) { WriteLine("You must enter three values: [min_ticket_value] [max_ticket_value] [ticket_size]\n" + "And all of these have ot be uint"); _logger.Error("You must enter three values: [min_ticket_value] [max_ticket_value] [ticket_size]\n" + "And all of these have ot be uint\n" + "{0}: {1}", ex, ex.Message); } _logger.Info("Progrem is finalized"); }
private double CheckConvertValue(string valueToDouble) { double doubleValue = _transformatorMaxRange.ConfirmConversion <double, string>(valueToDouble); _validatorMaxRange.CheckValue(doubleValue => { if (doubleValue == double.MaxValue) { return(false); } return(true); }, doubleValue); return(doubleValue); }