Exemplo n.º 1
0
        public void FIZZBUZZ_if_Mult_of_3_and_5()
        {
            var fbe    = new FizzBuzzEvaluator();
            int x      = 15;
            var result = fbe.Evaluate(x);

            Assert.IsTrue(result == "FIZZ BUZZ!");
        }
Exemplo n.º 2
0
        public void FizzIfMultOf3()
        {
            var fbe    = new FizzBuzzEvaluator();
            int x      = 3;
            var result = fbe.Evaluate(x);

            Assert.IsTrue(result == "fizz");
        }
Exemplo n.º 3
0
        public void NumberIfNotMultOf3or5()
        {
            var fbe    = new FizzBuzzEvaluator();
            int x      = 7;
            var result = fbe.Evaluate(x);

            Assert.IsTrue(result == x.ToString());
        }
Exemplo n.º 4
0
        public void NOTFizzOrBuzzIfNotMultOf3Or5()
        {
            var fbe    = new FizzBuzzEvaluator();
            int x      = 11;
            var result = fbe.Evaluate(x);

            Assert.IsFalse(result == "fizz" || result == "buzz");
        }
Exemplo n.º 5
0
        public void WhenDefaultCtorAndInputIsDivisibleBy3And5_ThenFizzBuzzIsReturned()
        {
            var fizzBuzz = new FizzBuzzEvaluator();

            var response = fizzBuzz.Evaluate(15);

            response.Should().Be("FizzBuzz!");
        }
Exemplo n.º 6
0
        public void WhenDefaultCtorAndInputIs2_Then2IsReturned()
        {
            var fizzBuzz = new FizzBuzzEvaluator();

            var response = fizzBuzz.Evaluate(2);

            response.Should().Be("2");
        }
Exemplo n.º 7
0
        public void GivenANumber_WhenEvaluated_ThenOutputShouldBEAsExpected(int number, string expected)
        {
            // arrange
            var target = new FizzBuzzEvaluator();

            // act
            var actual = target.Evaluate(number);

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 8
0
        public void When1Through100IsInput_ThenExpectedOutputIsReturned()
        {
            var fizzBuzz   = new FizzBuzzEvaluator();
            var outputList = new List <string>();

            for (int i = 1; i <= 100; i++)
            {
                var output = fizzBuzz.Evaluate(i);
                // outputList.Add(output.Output);
            }

            outputList.Should().BeEquivalentTo(_ExpectedOutput100);
        }
Exemplo n.º 9
0
        public void GivenAMultipleOf3ButContains3_WhenEvaluated_ThenTheOutputIsLucky()
        {
            // arrange
            var target      = new FizzBuzzEvaluator();
            var testNumbers = Enumerable.Range(1, 100)
                              .Select(x => x * 3)
                              .Where(multiple => multiple.ToString().Contains('3'));

            // act
            foreach (var testNumber in testNumbers)
            {
                // assert
                Assert.Equal("lucky", target.Evaluate(testNumber));
            }
        }