Ejemplo n.º 1
0
        public ActionResult GetNumericSequenceValues(int uservalue)
        {
            SequenceNumeric Seq_Num = new SequenceNumeric();

            var numbers           = Seq_Num.Numbers(uservalue);
            var odd_numbers       = Seq_Num.OddNumbers(uservalue);
            var even_numbers      = Seq_Num.EvenNumbers(uservalue);
            var custom_numbers    = Seq_Num.CustomNumbers(uservalue);
            var fibonacci_numbers = Seq_Num.FibonacciNumbers(uservalue);

            return(Json(new { numbers = numbers, oddnumbers = odd_numbers, evennumbers = even_numbers, customnumbers = custom_numbers, fibonaccinumbers = fibonacci_numbers, message = "success" }));
        }
Ejemplo n.º 2
0
        public void ShouldGetEvenNumbers(int value)
        {
            var        result  = sut.EvenNumbers(value);
            List <int> numbers = new List <int>();

            for (int i = 1; i <= value; i++)
            {
                if ((i % 2) == 0)
                {
                    numbers.Add(i);
                }
            }
            Assert.AreEqual(result, Is.EqualTo(numbers));
        }