SetupResult.cs

Summary
Sets the last method call to repeat any number of times and return the method options for the last method call, which usually will be a method call or property that is located inside the For.
Sets the last method call to repeat any number of times and return the method options for the last method call on the mockInstance.

Functions

For

Sets the last method call to repeat any number of times and return the method options for the last method call, which usually will be a method call or property that is located inside the For.  See Expected Usage.

Expected usage

SetupResult.For(mockObject.SomeCall()).Return(new Something());
SetupResult.For(mockList.Count).Return(50);

Thread safety

This method is not safe for multi threading scenarios!  If you need to record in a multi threading environment, use the On method, which can handle multi threading scenarios.

On

Sets the last method call to repeat any number of times and return the method options for the last method call on the mockInstance.  Unless you’re recording in multiply threads, you are probably better off using For

Expected usage

SetupResult.On(mockList).Call(mockList.Count).Return(50);

Thread safety

This method can be used in mutli threading scenarios.

Sets the last method call to repeat any number of times and return the method options for the last method call, which usually will be a method call or property that is located inside the For.
Sets the last method call to repeat any number of times and return the method options for the last method call on the mockInstance.