I have a class
public class MyClass
{
public int MyProperty1 { get; private set; }
public int MyProperty2 { get; private set; }
public MyClass(){}
public MyClass(int myProperty2) => MyProperty2 = myProperty2;
}
in my unit tests i need to change the value of MyProperty1 before making my assertion like below
[Fact]
public void MyTest()
{
var fake = NSubstitute.Substitute.For<MyClass>(3);
fake.MyProperty1.Returns(5);
//Assertion
}
However I am getting the error
Outcome: Failed
Error Message:
NSubstitute.Exceptions.CouldNotSetReturnDueToNoLastCallException : Could not find a call to return from.