public void FizzBuzz_CorrectNumberOfOutputItems()
        {
            var fizzBuzz = new FizzBuzzService();

            fizzBuzz.FizzBuzz();

            var result = fizzBuzz.FizzBuzzAdvanced(3, 5, 100);

            Assert.AreEqual(99, result.Count);
        }
Exemple #2
0
        public async Task TestDefaultMultiples(Multiple[] multiples)
        {
            const int min = 1, max = 100;
            var       config = new DefaultsConfig {
                DefaultMinValue = min, DefaultMaxValue = max, DefaultMultiples = multiples
            };
            var service = new FizzBuzzService(config);

            var result = await service.FizzBuzz();

            FizzBuzzValidation(min, max, result, multiples);
        }
Exemple #3
0
        public void FizzBuzzService_SuccessOn8th()
        {
            //Arange
            var input   = 8;
            var service = new FizzBuzzService();

            //Act
            var result = service.FizzBuzz(input);

            //Assert
            Assert.AreEqual("1,2,Fizz,4,Buzz,Fizz,7,8", string.Join(",", result));
        }
Exemple #4
0
        public void FizzBuzzService_SuccessOnThird()
        {
            //Arange
            var input   = 3;
            var service = new FizzBuzzService();

            //Act
            var result = service.FizzBuzz(input);

            //Assert
            Assert.AreEqual(string.Join(",", result), "1,2,Fizz");
        }
Exemple #5
0
        public void FizzBuzzService_SuccessOn25th()
        {
            //Arange
            var input   = 25;
            var service = new FizzBuzzService();

            //Act
            var result = service.FizzBuzz(input);

            //Assert
            Assert.AreEqual("1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz,16,17,Fizz,19,Buzz,Fizz,22,23,Fizz,Buzz", string.Join(",", result));
        }
Exemple #6
0
        public void FizzBuzzService_SuccessOnFirst()
        {
            //Arange
            var input   = 1;
            var service = new FizzBuzzService();

            //Act
            var result = service.FizzBuzz(input);

            //Assert
            Assert.AreEqual(result.First(), input.ToString());
        }
        public void FizzBuzz_CorrectFizzItems()
        {
            var fizzBuzz = new FizzBuzzService();

            fizzBuzz.FizzBuzz();

            var result = fizzBuzz.FizzBuzzAdvanced(3, 5, 100);

            Assert.AreEqual("Fizz", result[2]);
            Assert.AreEqual("Buzz", result[4]);
            Assert.AreEqual("FizzBuzz", result[14]);
        }
Exemple #8
0
        public async Task TestDefaults(int min, int max)
        {
            var multiples = new[] { new Multiple {
                                        Name = "Fizz", Value = 3
                                    } };
            var config = new DefaultsConfig {
                DefaultMinValue = min, DefaultMaxValue = max, DefaultMultiples = multiples
            };
            var service = new FizzBuzzService(config);

            var result = await service.FizzBuzz();

            FizzBuzzValidation(min, max, result, multiples);
        }
Exemple #9
0
        public void FizzBuzzService_Catches_Edge_Case()
        {
            //Arange
            var input   = -3;
            var service = new FizzBuzzService();

            //Act
            try
            {
                var result = service.FizzBuzz(input);
            }
            catch (ArgumentOutOfRangeException e)
            {
                return;
            }

            //Assert
            Assert.Fail("edge case");
        }