The Given15ThenFizzBuzz test

You might want to write a test method entitled GivenDivisibleBy3and5ThenFizzBuzz, but that may be too large of a leap at this point. We know that the first such number divisible by 3 and 5 is 15, so it might make more sense to start with this:

[Fact]
public void Given15ThenFizzBuzz()
{
// Arrange
// Act
var result = FizzBuzz(15);

// Assert
Assert.Equal("FizzBuzz", result);
}

How would you choose to make this test pass? Would you use an if/else statement? Perhaps a switch statement? We’ll leave this one as an exercise for the reader. Feel free to make this test pass in any way that you're comfortable with implementing. Remember to run your tests along the way to ensure you don't introduce a breaking change. If you do experience a test failure, feel free to ignore a test (Ignore attribute in MSTest, Skip parameter in xUnit), but only one test, while you fix your error(s).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.206.8