Esempio n. 1
0
        public void TestBadRule()
        {
            var rules = new IRule[] {new BadRule(), new FizzRule(), new BuzzRule()};
            var renderer = new FizzBuzzRenderer(rules);

            var output = renderer.FizzBuzzOutput(15);
            Assert.That(output == "FizzBuzz");
        }
Esempio n. 2
0
 public void TestDefaultOutput()
 {
     var rule1 = new Mock<IRule>();
     rule1.Setup(s => s.ProcessRule(It.IsAny<int>())).Returns("FIZZ");
     var rule2 = new Mock<IRule>();
     rule2.Setup(s => s.ProcessRule(It.IsAny<int>())).Returns("BUZZ");
     var renderer = new FizzBuzzLibrary.FizzBuzzRenderer(new IRule[]{rule1.Object,rule2.Object});
     var output = renderer.FizzBuzzOutput(1);
     Assert.That(output == "FIZZBUZZ", "Expected 'FIZZBUZZ', got {0}", output);
 }
Esempio n. 3
0
 public void TestDefaultOutput()
 {
     var rule1 = new Mock<IRule>();
     rule1.Setup(s => s.ProcessRule(It.IsAny<int>())).Returns("FIZZ");
     var rule2 = new Mock<IRule>();
     rule2.Setup(s => s.ProcessRule(It.IsAny<int>())).Returns("BUZZ");
     var renderer = new FizzBuzzLibrary.FizzBuzzRenderer(new IRule[]{rule1.Object,rule2.Object});
     var output = renderer.FizzBuzzOutput(1);
     Assert.That(output == "FIZZBUZZ", "Expected 'FIZZBUZZ', got {0}", output);
 }
Esempio n. 4
0
 public FizzBuzzLooper(FizzBuzzRenderer renderer)
 {
     _renderer = renderer;
 }
Esempio n. 5
0
 public FizzBuzzLooper(FizzBuzzRenderer renderer)
 {
     _renderer = renderer;
 }