Example #1
0
        public void Print_ForOnePrinterAndNumberWithOutput_ShouldReturnOutput()
        {
            const int    Number = 1;
            const string Output = "Fizz";

            var printer          = CreatePrinter(Number, Output);
            var compositePrinter = new CompositePrinter(new[] { printer });

            Assert.AreEqual(Output, compositePrinter.Print(Number));
        }
Example #2
0
        public void Print_ForOnePrinterAndNumberWithoutOutput_ShouldReturnOutput()
        {
            const int    NumberUnderTest = 1;
            const int    OtherNumber     = 2;
            const string Output          = "Fizz";

            var printer          = CreatePrinter(OtherNumber, Output);
            var compositePrinter = new CompositePrinter(new[] { printer });

            Assert.AreEqual(NumberUnderTest.ToString(), compositePrinter.Print(NumberUnderTest));
        }
Example #3
0
        public void Print_ForTwoPrintersAndNumberWithOutputInBothPrinters_ShouldReturnOutput()
        {
            const int    NumberUnderTest = 1;
            const string Output1         = "Fizz";
            const string Output2         = "Buzz";

            var printer1         = CreatePrinter(NumberUnderTest, Output1);
            var printer2         = CreatePrinter(NumberUnderTest, Output2);
            var compositePrinter = new CompositePrinter(new[] { printer1, printer2 });

            Assert.AreEqual(string.Concat(Output1, Output2), compositePrinter.Print(NumberUnderTest));
        }