Using FakeItEasy, I am trying to capture the setting of a property value on a fake object:
First the interface:
interface ISomeInterface
{
int MyProperty {get;set;}
}
Then a fragment of unit test:
var myObject = A.Fake<ISomeInterface>();
int saved = 0;
A.CallTo (() => myObject.MyProperty).Invokes (x => saved = ?????);
SomeMethod (myObject);
Assert.That (saved, Is.EqualTo (100));
And having
void SomeMethod (ISomeInterface intf)
{
intf.MyProperty = 100;
}
I don't know what to put to replace the ?????
var myObject = A.Fake<ISomeInterface>();
SomeMethod (myObject);
Assert.That (saved.MyProperty, Is.EqualTo(100));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With