Skip to content

Commit 76f624e

Browse files
fix: matchers documentation (#145)
* fix: matchers documentation - add Arg.Ref in the last 3 VB examples - change hightligt sentance - fix logical mistake closes #722 * fix: matchers documentation - add Arg.Ref in the last 3 VB examples - change highlight sentance - fix logical mistake closes #722
1 parent 72d9766 commit 76f624e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

basic-usage/matchers.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ With the first line we specify that when the __foo.Echo__ method is called with
115115
{{endregion}}
116116

117117

118-
On the second line we specify the __RangeKind__ to be __Exclusive__ so calling the method with 6 or 10 doesn’t satisfy the condition because these values are excluded from the range.
118+
On the second line we specify the __RangeKind__ to be __Exclusive__ so calling the method with 0 or 5 doesn’t satisfy the condition because these values are excluded from the range.
119119

120-
## Arg.Matches<T> (Expression<Predicate<T>> expression)
120+
## Arg.Matches\<T\> (Expression\<Predicate\<T\>\> expression)
121121

122122
This is the most flexible matcher and it allows you to specify your own matching expression. Let's illustrate it with a simple example:
123123

124124
#### __[C#]__
125125

126126
{{region Matchers##ArgMatchesCS}}
127-
Mock.Arrange(() => foo.Echo(Arg.Matches<int>( x => x < 10)).Returns(true);
127+
Mock.Arrange(() => foo.Echo(Arg.Matches<int>( x => x < 10))).Returns(true);
128128
{{endregion}}
129129

130130
#### __[VB]__
@@ -356,7 +356,7 @@ In the case when a specialization is used among with `Arg.IsAny<T>`, JustMock wi
356356

357357
## Using Matchers for ref Arguments (Arg.Ref())
358358

359-
> __`Arg.Ref` is used only in C# assemblies, as for Visual Basic you can directly match `ByRef` arguments without it.__
359+
> __The use of `Arg.Ref` in Visual Basic is optional, as you can directly match `ByRef` arguments without it.__
360360
361361
With JustMock you are able to use matchers for functions that take ref arguments. For this purpose, you need to use the `Arg.Ref().Value` syntax. Check the next examples for further guidance:
362362

@@ -394,7 +394,7 @@ With JustMock you are able to use matchers for functions that take ref arguments
394394
' Arrange
395395
Dim foo = Mock.Create(Of IFoo)()
396396

397-
Mock.Arrange(Function() foo.Bar(5)).Returns(10)
397+
Mock.Arrange(Function() foo.Bar(Arg.Ref(5).Value)).Returns(10)
398398

399399
' Act
400400
Dim actual As Integer = foo.Bar(myRefArg)
@@ -441,7 +441,7 @@ With JustMock you are able to use matchers for functions that take ref arguments
441441
' Arrange
442442
Dim foo = Mock.Create(Of IFoo)()
443443

444-
Mock.Arrange(Function() foo.Bar(Arg.AnyInt)).Returns(10)
444+
Mock.Arrange(Function() foo.Bar(Arg.Ref(Arg.AnyInt).Value)).Returns(10)
445445

446446
' Act
447447
Dim actual As Integer = foo.Bar(myRefArg)
@@ -488,7 +488,7 @@ With JustMock you are able to use matchers for functions that take ref arguments
488488
' Arrange
489489
Dim foo = Mock.Create(Of IFoo)()
490490

491-
Mock.Arrange(Function() foo.Bar(Arg.Matches(Of Integer)(Function(x) x > 10))).Returns(10)
491+
Mock.Arrange(Function() foo.Bar(Arg.Ref(Arg.Matches(Of Integer)(Function(x) x > 10)).Value)).Returns(10)
492492

493493
' Act
494494
Dim actual As Integer = foo.Bar(myRefArg)

0 commit comments

Comments
 (0)