Esempio n. 1
0
        public void All_numbers_count_should_match_the_passed_number()
        {
            int number   = 5;
            var response = NumericSequenceHelper.GenerateNumericSequence(number);

            Assert.Equal(response.AllNumbers.Count, number);
        }
Esempio n. 2
0
        public void All_numbers_except_count()
        {
            int number   = 5;
            var response = NumericSequenceHelper.GenerateNumericSequence(number);

            Assert.Equal(response.AllNumbersExcept.Count, number);
        }
Esempio n. 3
0
        public void Even_numbers_count()
        {
            int number          = 5;
            int evenNumberCount = 2; // 2,4
            var response        = NumericSequenceHelper.GenerateNumericSequence(number);

            Assert.Equal(response.EvenNumbers.Count, evenNumberCount);
        }
Esempio n. 4
0
        public void Odd_numbers_count()
        {
            int number         = 5;
            int oddNumberCount = 3; // 1,3,5
            var response       = NumericSequenceHelper.GenerateNumericSequence(number);

            Assert.Equal(response.OddNumbers.Count, oddNumberCount);
        }
Esempio n. 5
0
        public void All_numbers_except_contains_letters()
        {
            int number   = 15;
            var response = NumericSequenceHelper.GenerateNumericSequence(number);

            Assert.True(response.AllNumbersExcept.Contains("C"));
            Assert.True(response.AllNumbersExcept.Contains("E"));
            Assert.True(response.AllNumbersExcept.Contains("Z"));
        }
Esempio n. 6
0
        public ApiResponse <NumericSequenceResponse> GetNumericSequence(int number)
        {
            ApiResponse <NumericSequenceResponse> response = null;

            if (number <= 0)
            {
                response = new ApiResponse <NumericSequenceResponse>("Invalid number");
            }
            else
            {
                var numericSequenceResponse = NumericSequenceHelper.GenerateNumericSequence(number);
                response = new ApiResponse <NumericSequenceResponse>(numericSequenceResponse);
            }

            return(response);
        }