I am trying to use NSubstitution in my C# Unit testing program.
I am trying to do a substitution on a method called inside of a mehtod. here is an example:
public class operation
{
public int addition(int a, int b)
{
return (a + b);
}
}
public class anotherClass
{
public int increment(int ax, int bx)
{
operation loc = new operation();
ax = loc.addition(ax,bx);
return (ax + 1);
}
}
Is it possible to call increment() method in my main function and apply substitution to the addition() method?
I want to force a return value in the addition() method when called in the increment() method. e.g. force an ecxeption throw.
Also, I can't edit the code so adding an interface implementation would not be a good solution.