Junior — Middle
How are test scenarios launched in a project?
sobes.tech AI
Answer from AI
In C# projects, frameworks such as NUnit or MSTest are typically used to run test scenarios. Tests are written as methods with attributes, for example [Test] for NUnit. Tests can be run through Visual Studio Test Explorer or via the command line using dotnet test.
Example of a simple test with NUnit:
using NUnit.Framework;
[TestFixture]
public class CalculatorTests
{
[Test]
public void Add_TwoNumbers_ReturnsSum()
{
var calc = new Calculator();
Assert.AreEqual(5, calc.Add(2, 3));
}
}
Thus, tests are run automatically, and results are displayed in a convenient format.