Exemple #1
0
        public static void Main(string[] args)
        {
            // Key / Value Pairs and Upper and lower Limits could very well have been stored in a config file,
            // database, etc but I'm just simulating that by setting them directly in this client console application.
            const int LOWERLIMIT = -20;
            const int UPPERLIMIT = 200;

            Dictionary<int, string> keyValuePairs = new Dictionary<int, string>();
            keyValuePairs.Add(2, "POP");
            keyValuePairs.Add(3, "FIZZ");
            keyValuePairs.Add(5, "BUZZ");
            keyValuePairs.Add(7, "CRACKLE");

            FizzBuzzRemainder.FizzBuzzRemainder fizzBuzzRemainder = new FizzBuzzRemainder.FizzBuzzRemainder(LOWERLIMIT, UPPERLIMIT);

            try
            {
                fizzBuzzRemainder.CountNumbers(keyValuePairs);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Read();
        }
Exemple #2
0
        public void UpperLimitHigherThanLowerLimit()
        {
            int lowerlimit = 50;
            int upperlimit = 30;

            FizzBuzzRemainder.FizzBuzzRemainder fizzBuzzRemainder = new FizzBuzzRemainder.FizzBuzzRemainder(lowerlimit, upperlimit);
            fizzBuzzRemainder.CountNumbers(keyValuePairs);
        }
Exemple #3
0
        public void KeyValuePairIsNull()
        {
            int lowerlimit = 30;
            int upperlimit = 50;

            keyValuePairs = null;

            FizzBuzzRemainder.FizzBuzzRemainder fizzBuzzRemainder = new FizzBuzzRemainder.FizzBuzzRemainder(lowerlimit, upperlimit);
            fizzBuzzRemainder.CountNumbers(keyValuePairs);
        }
Exemple #4
0
        public void KeyValuePairIsEmpty()
        {
            int lowerlimit = 30;
            int upperlimit = 50;

            keyValuePairs.Clear();

            FizzBuzzRemainder.FizzBuzzRemainder fizzBuzzRemainder = new FizzBuzzRemainder.FizzBuzzRemainder(lowerlimit, upperlimit);
            fizzBuzzRemainder.CountNumbers(keyValuePairs);
        }