Ejemplo n.º 1
0
        public void Run()
        {
            try
            {
                if (!_checker.IsNumber())
                {
                    _consoleViewer.ShowMessage(DefaultSettings.NO_NUMBER);
                    return;
                }

                if (!_checker.IsAboveThanZero())
                {
                    _consoleViewer.ShowMessage(DefaultSettings.LESS_THAN_ZERO);
                    return;
                }

                long lastNumber = long.Parse(_finishRange);
                NumericalSequence  naturalNumbers = new NumericalSequence(lastNumber);
                IEnumerable <long> sequence       = naturalNumbers.GetNumbers();
                _consoleViewer.ShowSequence(sequence);
            }
            catch (OverflowException ex)
            {
                _consoleViewer.ShowMessage(string.Format("{0}\n{1}", ex.Message, _instruction));
            }
        }