Beispiel #1
0
        public void GivenEndIsSetToZero_WhenRunningFizzBuzzRunner_ThenSingleItemIsOutput()
        {
            var end            = 0;
            var expectedResult = $"0: {Environment.NewLine}";
            var fakeOutput     = new FakeOutput();

            FizzBuzzRunner.Run(end, fakeOutput);
            Assert.AreEqual(expectedResult, fakeOutput.OutputResult);
        }
Beispiel #2
0
        public void GivenInput_WhenRunningFizzBuzzRunner_ThenOutputTheNumberAndCorrectText(int number, string expectedOutput)
        {
            var fakeOutput = new FakeOutput();

            FizzBuzzRunner.Run(number, fakeOutput);

            var actualItems  = fakeOutput.OutputResult.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            var actualOutput = actualItems.SingleOrDefault(s => s.StartsWith($"{number}: "));

            Assert.AreEqual(expectedOutput, actualOutput);
        }
Beispiel #3
0
        public void GivenEndIsSetToOneThousand_WhenRunningFizzBuzzRunner_ThenOneThousandAndOneItemsAreOutput()
        {
            var end = 1000;
            var expectedNumberOfItems = 1001;
            var fakeOutput            = new FakeOutput();

            FizzBuzzRunner.Run(end, fakeOutput);

            var actualNumberOfItems = fakeOutput.OutputResult.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            Assert.AreEqual(expectedNumberOfItems, actualNumberOfItems.Length);
        }