Sobes.tech
Junior — Middle

Have you ever created test scenarios or automated checks for your code?

sobes.tech AI

Answer from AI

Yes, creating test scenarios and automated checks is an important practice for ensuring code quality.

In C#, frameworks like NUnit or MSTest are often used for this purpose. Here's a simple example of an automated test using NUnit:

using NUnit.Framework;

public class Calculator
{
    public int Add(int a, int b) => a + b;
}

[TestFixture]
public class CalculatorTests
{
    [Test]
    public void Add_WhenCalled_ReturnsSum()
    {
        var calculator = new Calculator();
        int result = calculator.Add(2, 3);
        Assert.AreEqual(5, result);
    }
}

This test allows for automatic verification that the Add method works correctly when code changes are made.

Have you ever created test scenarios or automated… - sobes.tech