Read/Write Property Behavior
Although you can explicitly
specify the return value for a called property getter,
there's an easier, more intuitive way to work with read/write
properties. By default, any
that has both a
get accessor behaves like you might
expect. Setting a value and then getting the value returns the value
that was set.
var fakeShop = A.Fake<ICandyShop>(); fakeShop.Address = "123 Fake Street"; System.Console.Out.Write(fakeShop.Address); // prints "123 Fake Street"
This behaviour can be used to
- supply values for the system under test to use (via the getter) or to
- verify that the system under test performed the
setaction on the Fake