public String ConvertToFizzBuzz(int input) { IFizzChecker fizzChecker; fizzChecker = new FizzChecker(); IBuzzChecker buzzChecker; buzzChecker = new BuzzChecker(); if (fizzChecker.FizzNumber(input) && buzzChecker.BuzzNumber(input)) { return("FizzBuzz"); } else if (fizzChecker.FizzNumber(input)) { return("Fizz"); } else if (buzzChecker.BuzzNumber(input)) { return("Buzz"); } else { return(input.ToString()); } }
public void NotAMultipleOf5ReturnsFalse() { // Arrange IBuzzChecker buzzChecker; buzzChecker = new BuzzChecker(); int testInt1 = 4; int testInt2 = 78; // Act bool testReturn1 = buzzChecker.BuzzNumber(testInt1); bool testReturn2 = buzzChecker.BuzzNumber(testInt2); // Assert Assert.AreEqual(false, testReturn1); Assert.AreEqual(false, testReturn2); }
public void MultipleOf5ReturnsTrue() { // Arrange IBuzzChecker buzzChecker; buzzChecker = new BuzzChecker(); int testInt1 = 10; int testInt2 = 95; // Act bool testReturn1 = buzzChecker.BuzzNumber(testInt1); bool testReturn2 = buzzChecker.BuzzNumber(testInt2); // Assert Assert.AreEqual(true, testReturn1); Assert.AreEqual(true, testReturn2); }