コード例 #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" }));
        }
コード例 #2
0
        public void ShouldGetFibonacciNumbers(int value)
        {
            var        result  = sut.FibonacciNumbers(value);
            List <int> numbers = new List <int>();

            numbers.Add(0);
            numbers.Add(1);
            numbers.Add(1);
            numbers.Add(2);
            numbers.Add(3);
            numbers.Add(5);

            Assert.That(result, Is.EqualTo(numbers));
        }