Junior — Middle
What tools for automated testing have you used in your projects?
sobes.tech AI
Answer from AI
In C# projects, I used several tools for automated testing:
- NUnit — a popular framework for unit testing, allowing you to write and run tests with various attributes and assertions.
- MSTest — a testing framework built into Visual Studio, convenient for integration with CI/CD.
- xUnit.net — a modern framework with a simple and flexible API, often used in .NET Core projects.
- Moq — a library for creating mock objects, enabling isolation of tested components from dependencies.
Example of a simple test with NUnit:
using NUnit.Framework;
[TestFixture]
public class CalculatorTests
{
[Test]
public void Add_TwoNumbers_ReturnsSum()
{
var calculator = new Calculator();
var result = calculator.Add(2, 3);
Assert.AreEqual(5, result);
}
}
These tools helped ensure code quality and automate functionality testing.