Controlling Property Behavior Using Isolate.WhenCalled()
Because a property expands to 2 methods, a getter and a setter, an alternative way to control a property is to use Isolate.WhenCalled().
When to Use
When your test requires a fake property to return a specific value.
Syntax
C# Isolate.WhenCalled(() => <property>).WillReturn(<value>);
VB
Isolate.WhenCalled(Function() <property>).WillReturn(<value>)
Samples
To fake a set property, you need to place the statement into a block.
C# var fakeDependency = Isolate.Fake.Instance<Dependency>(); Isolate.WhenCalled(() => fakeDependency.Number).WillReturn(5);
VB
Dim fakeDependency = Isolate.Fake.Instance(Of Dependency)()
Isolate.WhenCalled(Function() fakeDependency.Number()).WillReturn(5)