.NET Framework Unit testing Creating a sample test method

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

MSTest (the default testing framework) requires you to have your test classes decorated by a [TestClass] attribute, and the test methods with a [TestMethod] attribute, and to be public.

[TestClass]
public class FizzBuzzFixture
{
    [TestMethod]
    public void Test1()
    {
        //arrange
        var solver = new FizzBuzzSolver();
        //act
        var result = solver.FizzBuzz(1);
        //assert
        Assert.AreEqual("1",result);
    }
}


Got any .NET Framework Question?