My name is Nofar and I'm from Typemock's support team.
When you use the WillReturn API, you will get the same 'x' value it had while writing the willReturn phrase. So, changing it's value after this phrase is not relevant.
For this case, you can use the DoInstead API, like this:
[TestMethod]
public void TestPropertyGetter_ReturningNonHardCodedValuesIsolator()
{
var fake = new MyClass();
var x = 0;
Isolate.WhenCalled(() => fake.Number).DoInstead(y =>
{
return x;
});
x++;
Assert.AreEqual(1, fake.Number);
}
}
May I ask what is it that you are trying to test?
Regards,
Nofar
Typemock Support
The Unit Testing Company