示例#1
0
        public void ShouldGetCustomNumbers(int value)
        {
            var           result  = sut.CustomNumbers(value);
            List <string> numbers = new List <string>();

            for (int i = 1; i <= value; i++)
            {
                if (((i % 5) == 0 && (i % 3) == 0)) //Multiple of 5 and  3
                {
                    numbers.Add("Z");
                }
                else if ((i % 5) == 0) //Multiple of 5
                {
                    numbers.Add("E");
                }
                else if ((i % 3) == 0)//Multiple OF 3
                {
                    numbers.Add("C");
                }
                else
                {
                    numbers.Add(i.ToString());
                }
            }

            Assert.That(result, Is.EqualTo(numbers));
        }
示例#2
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" }));
        }