public void can_handle_unsorted_messages()
        {
            var fizzer = new FizzBuzzOmatic();

            fizzer.Add(4, "Frog");
            fizzer.Add(13, "Duck");
            fizzer.Add(9, "Chicken");

            var resultFrogDuckChicken = fizzer.ProduceRange(468, 468);
            var resultFrogDuck        = fizzer.ProduceRange(52, 52);
            var resultFrogChicken     = fizzer.ProduceRange(36, 36);
            var resultDuckChicken     = fizzer.ProduceRange(13 * 9, 13 * 9);

            Assert.Equal("FrogDuckChicken", resultFrogDuckChicken.FirstOrDefault());
            Assert.Equal("FrogDuck", resultFrogDuck.FirstOrDefault());
            Assert.Equal("FrogChicken", resultFrogChicken.FirstOrDefault());
            Assert.Equal("DuckChicken", resultDuckChicken.FirstOrDefault());
        }
        public void can_solve_classic_fizzbuzz_backwards()
        {
            var fizzer = new FizzBuzzOmatic();

            fizzer.Add(3, "Fizz");
            fizzer.Add(5, "Buzz");

            var result = fizzer.ProduceRange(100, 1);

            var expected = FizzBuzzCsvFile.Read <FizzBuzzCsvFile.FizzBuzzDataRecord>(Path.Combine("Data", "FizzBuzzData.csv")).Reverse();

            Assert.Equal(expected, result);
        }
        public void can_solve_classic_fizzbuzz()
        {
            var fizzer = new FizzBuzzOmatic();

            fizzer.Add(3, "Fizz");
            fizzer.Add(5, "Buzz");

            var result = fizzer.ProduceRange(1, 100);

            var expected = FizzBuzzCsvFile.Read <FizzBuzzCsvFile.FizzBuzzDataRecord>(Path.Combine("Data", "FizzBuzzData.csv"));

            Assert.Equal(expected.ToArray(), result.ToArray());
        }
        public void can_solve_super_fizzbuzz()
        {
            var fizzer = new FizzBuzzOmatic();

            fizzer.Add(3, "Fizz");
            fizzer.Add(7, "Buzz");
            fizzer.Add(38, "Bazz");

            var result = fizzer.ProduceRange(-12, 145);

            var expected = FizzBuzzCsvFile.Read <FizzBuzzCsvFile.SuperFizzBizzDataRecord>(Path.Combine("Data", "SuperFizzBuzzData.csv"));

            Assert.Equal(expected.ToArray(), result.ToArray());
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var fizz = new FizzBuzzOmatic();

            fizz.Add(3, "Fizz")
            .Add(5, "Buzz");

            var results = fizz.ProduceRange(1, 100);

            Console.WriteLine("ClassicFizzBuzz: from 1 to 100");
            foreach (var item in results)
            {
                Console.WriteLine(item);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            var fizz = new FizzBuzzOmatic();

            fizz.Add(3, "Fizz")
            .Add(7, "Buzz")
            .Add(38, "Bazz");

            var results = fizz.ProduceRange(-12, 145);

            Console.WriteLine("SuperFizzBuzz: from -12 to 145");
            foreach (var item in results)
            {
                Console.WriteLine(item);
            }
        }