public void Returns_Fizz_If_Divisible_By_3()
        {
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Clear();
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Add(3, "Fizz");

            Assert.That(SuperFizzBuzzFactory.Output(3), Is.EqualTo("Fizz"));
            Assert.That(SuperFizzBuzzFactory.Output(6), Is.EqualTo("Fizz"));
            Assert.That(SuperFizzBuzzFactory.Output(9), Is.EqualTo("Fizz"));
        }
        public void Returns_Buzz_If_Divisible_By_5()
        {
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Clear();
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Add(5, "Buzz");

            Assert.That(SuperFizzBuzzFactory.Output(5), Is.EqualTo("Buzz"));
            Assert.That(SuperFizzBuzzFactory.Output(10), Is.EqualTo("Buzz"));
            Assert.That(SuperFizzBuzzFactory.Output(20), Is.EqualTo("Buzz"));
        }
        public void Returns_Number_If_Not_Divisible_By_3_Or_5()
        {
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Clear();
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Add(3, "Fizz");
            SuperFizzBuzzFactory.NumberAndTokenDictionary.Add(5, "Buzz");

            Assert.That(SuperFizzBuzzFactory.Output(1), Is.EqualTo("1"));
            Assert.That(SuperFizzBuzzFactory.Output(22), Is.EqualTo("22"));
            Assert.That(SuperFizzBuzzFactory.Output(187), Is.EqualTo("187"));
        }
Ejemplo n.º 4
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the demo for basic usage of SuperFizzBuzz library!");
            Console.WriteLine("=======================================================================");
            //	Adding default values
            SuperFizzBuzzFactory.AddBasicConfiguration();

            for (var i = 1; i < 100; i++)
            {
                var outPut = SuperFizzBuzzFactory.Output(i);
                Console.WriteLine(outPut);
            }

            Console.WriteLine("Press enter to quit...");
            Console.ReadLine();
        }
Ejemplo n.º 5
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the demo for advanced usage of SuperFizzBuzz library!");
            Console.WriteLine("=======================================================================");
            Console.WriteLine("Please enter a range of numbers for iterate\n");

            Console.WriteLine("Enter first number: ");
            int.TryParse(Console.ReadLine(), out int num1);

            Console.WriteLine("\nEnter the second number: ");
            int.TryParse(Console.ReadLine(), out int num2);

            SuperFizzBuzzFactory.AskForNumbersAndTokens();

            for (var i = num1; i < num2; i++)
            {
                var outPut = SuperFizzBuzzFactory.Output(i);
                Console.WriteLine(outPut);
            }

            Console.WriteLine("\n\nPress enter to quit...");
            Console.ReadLine();
        }