Unit Testing in Visual Studio

Let's walk through the steps for unit testing in Visual Studio 2022.

Setting up a .NET console application xUnit test

Step 1: Create a console application and name it UTCalculator.

Step 2: Create a class named CalculatorFeatures and add a method called AddTwoNumbers.

namespace UTCalculator {
    public class CalculatorFeatures
    {
        public static int AddTwoNumbers(int num1, int num2)
        {
            int result = num1 - num2;
            return result;
        }
    } 
}

Step 3: Add the following, Console.WriteLine, above the namespace UTCalculator.

 ...