public void NoMatch()
        {
            var fizzBuzz = new FizzBuzzMachine(divisorAndWords);

            Assert.Equal("1", fizzBuzz.Say(1));
            Assert.Equal("2", fizzBuzz.Say(2));
        }
        public void MultipleMatch()
        {
            var fizzBuzz = new FizzBuzzMachine(divisorAndWords);

            Assert.Equal("FizzBuzz", fizzBuzz.Say(3 * 5));
            Assert.Equal("FizzBuzz", fizzBuzz.Say(3 * 5 * 2));
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to FizzBuzz");

            var fizzBuzz = new FizzBuzzMachine(new[]
            {
                new DivisorAndWord(3, "Fizz"),
                new DivisorAndWord(5, "Buzz"),
                new DivisorAndWord(7, "Bang")
            });

            for (int i = 1; i < 500; i++)
            {
                var result = fizzBuzz.Say(i);
                Print(result);
            }
        }