Beispiel #1
0
        private static void PrintList(int count, List <DivisibleFactor> divisibleFactors, bool ascending = true)
        {
            var service = new FizzBuzzService(100, divisibleFactors, ascending);

            service.Process();
            service.Print();
        }
Beispiel #2
0
        public void FizzBuzzService_Process_GivenValidData_CompilesCorrectList(int sampleSize, bool ascending,
                                                                               List <DivisibleFactor> divisibleFactors, List <string> expected)
        {
            service = new FizzBuzzService(sampleSize, divisibleFactors, ascending);

            service.Process();

            var actual = service.ProcessedList;

            Assert.Equal(actual, expected);
        }
Beispiel #3
0
        //Get Fizz/Buzz based on multiples of 3/5.
        static void Main(string[] args)
        {
            //Read input from app.config
            string input = ConfigurationManager.AppSettings[Helpers.Helpers.INPUTNUMBER].ToString();
            string output;

            if (ValidateInput(input))
            {
                //Call Fizz Buzz Service
                IFizzBuzzService fizzBuzzService = new FizzBuzzService();
                output = fizzBuzzService.Process(Convert.ToInt16(input));
            }
            else
            {
                output = Helpers.Helpers.ERRORINPUT;
            }

            Console.WriteLine(output);
            Console.WriteLine(Helpers.Helpers.PRESSKEY);
            Console.ReadLine();
        }
        public void Multiple_of_Three_Should_beFizz()
        {
            string result = _service.Process(33);

            Assert.AreEqual(Helpers.Helpers.MULTIPLEOFTHREE, result);
        }
Beispiel #5
0
        public void FizzBuzzService_Process_GivenEmptyListOfDivisibleFactors_ThrowFizzBuzzException()
        {
            service = new FizzBuzzService(100, new List <DivisibleFactor>());

            Assert.Throws <FizzBuzzException>(() => service.Process());
        }