Skip to content

Commit da6023d

Browse files
committed
Minor clarification with callbacks and return values
1 parent c416982 commit da6023d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/Overview.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ var x = mock.TargetFunc();
270270
expectations.Verify();
271271
```
272272

273+
> [!TIP]
274+
> If a method returns a value, you only need to call `Callback()` or `ReturnValue()`. Rocks will look to see if a callback has been given, and if it has, it uses that delegate to get the return value - it'll ignore the return value specified with `ReturnValue()`. If no callback is given, then you must call `ReturnValue()` to provide a return value.
275+
273276
### Passing Constructor Arguments to a Mock
274277

275278
If you want to mock a class with virtual members where the class only has constructors with multiple arguments, you can do it. You pass the constructor arguments to `Instance()`. Rocks will generate an override of `Instance()` for each constructor that exists on the target type. Here's an example:

0 commit comments

Comments
 (0)