Junior — Middle
What types of tests have you created in your projects?
sobes.tech AI
Answer from AI
In my projects, I have created the following types of tests in C#:
- Unit Tests for checking individual methods and classes using NUnit or MSTest.
- Integration Tests to verify the interaction between components.
- Functional Tests that check the business logic of the application.
Example of a simple unit test with NUnit:
using NUnit.Framework;
public class CalculatorTests
{
[Test]
public void Add_TwoNumbers_ReturnsSum()
{
var calculator = new Calculator();
int result = calculator.Add(2, 3);
Assert.AreEqual(5, result);
}
}
public class Calculator
{
public int Add(int a, int b) => a + b;
}