Ejemplo n.º 1
0
        private static async Task Run(IFizzService fizzService, IBuzzService buzzService, INumberService numberService)
        {
            var max = 120;

            var timings = new Timings();

            var numbers = numberService.GetAll(max);

            await foreach (var number in numbers)
            {
                var fizz = await fizzService.Get(number.Id);

                var buzz = await buzzService.Get(number.Id);

                var word = fizz.Fizzable ? $"Fizz{buzz?.Word}" : buzz?.Word ?? number.Word;
                if (number.Id == 1)
                {
                    timings.FirstResult = DateTime.Now;
                }
                Console.WriteLine(word);
            }
            timings.End = DateTime.Now;
            timings.Print();
        }