Hi i am running simplest test to evaluate Ncrunch for my application, unable to use it. I am using simplest sample code
created console app
namespace ConsoleApp6
{
// Simple calculator class to add two integers
public class Adder
{
public int Add(int a, int b)
{
return a + b;
}
}
internal class Program
{
static void Main(string[] args)
{
var adder = new Adder();
int result = adder.Add(2, 3);
Console.WriteLine("Result: " + result);
}
}
}
unit test
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ConsoleApp6; // add this
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void Add_TwoAndThree_ReturnsFive()
{
// arrange
var adder = new Adder();
// act
var result = adder.Add(2, 3);
// assert
Assert.AreEqual(5, result);
}
}
}
error in ncrunch
The 'Restrict ToString usage to avoid side-effects' setting is currently enabled for this solution.
When this setting is enabled, NCrunch will take an extremely cautious approach to calling the 'ToString' method on objects that are collected by RDI, potentially losing the opportunity to capture and report more useful information about these objects.
When first using RDI on a solution, a cautious approach is recommended because 'ToString' methods can sometimes contain side-effects that can change the behaviour of code being executed by NCrunch. As RDI calls these methods extensively, this can result in tests failing without obvious reason or explanation.
If your codebase is stable with RDI, it is recommended you try disabling this setting for a better experience with NCrunch.
When writing 'ToString' methods, ensure the code in these methods does not change the state of objects involved. If you encounter problems with 'ToString' methods implemented on system types or widely used frameworks, please report this to the NCrunch development team via the bug reporter, as we maintain a built-in list of types to exclude from RDI by default.
Click here to hide this warning
no test cases is run its ignored