Esempio n. 1
0
        public void ValidateInputs_1_To_15()
        {
            int i = 0;
            List<string> results = new List<string> { "1", "2", "Fizz", "4", "Buzz",
                                                      "Fizz", "7", "8", "Fizz", "Buzz",
                                                      "11", "Fizz", "13", "14", "FizzBuzz" };

            FizzBuzz fb = new FizzBuzz(1, 15);

            foreach (string s in fb.GetResults())
                Assert.AreEqual(results[i++], s);
        }
Esempio n. 2
0
        public void ValidateInputs_DivisibleBy5()
        {
            int i = 1;

            FizzBuzz fb = new FizzBuzz(1, 100);

            foreach (string s in fb.GetResults())
            {
                if (i % 5 == 0 && i % 3 != 0)
                    Assert.AreEqual("Buzz", s);

                i++;
            }
        }
Esempio n. 3
0
        public void ValidateInputs_MaxAndMinRange()
        {
            long i = Int32.MinValue;
            bool bMarkerHit = false;

            FizzBuzz fb = new FizzBuzz(Int32.MinValue, Int32.MaxValue);

            foreach (string s in fb.GetResults())
            {
                if (i == Int32.MinValue + 1)
                {
                    if (bMarkerHit)
                    {
                        Assert.Fail("The enumeration is in an infinte loop.");
                    }
                    else
                    {
                        bMarkerHit = true;
                    }
                }

                i++;
            }
        }
Esempio n. 4
0
        public void ValidateInputs_NotDivisibleBy3Or5()
        {
            int i = 1;

            FizzBuzz fb = new FizzBuzz(1, 100);

            foreach (string s in fb.GetResults())
            {
                if (i % 5 != 0 && i % 3 != 0)
                    Assert.AreEqual(i.ToString(), s);

                i++;
            }
        }