Creating Test 2

Next, we want to test if the given value is 3, it should print 1, 2, Fizz. Let's create another test method.

[TestMethod]
public void Given3Return12Fizz()
{
    FizzBuzzController controller = new FizzBuzzController();
    ..
    ..
    Assert.AreEqual(expected, actual);
}

The method inside actually look alike with the First test.

ViewResult result = controller.Index(3) as ViewResult;
string expected = "1 2 Fizz";
string actual = result.ViewBag.Output;

Run the test and ensure the test is failed.

results matching ""

    No results matching ""