From f90400dc06529e70a8d14404de02fc2b4572e105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Wed, 21 Jan 2026 13:44:41 +0100 Subject: [PATCH 1/2] docs: document `Match.AnyParameters` and `Match.Parameters` --- Docs/pages/01-create-mocks.md | 4 ++-- Docs/pages/02-setup.md | 14 +++++++++++--- README.md | 10 ++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Docs/pages/01-create-mocks.md b/Docs/pages/01-create-mocks.md index fa2c5188..76a28abe 100644 --- a/Docs/pages/01-create-mocks.md +++ b/Docs/pages/01-create-mocks.md @@ -44,8 +44,8 @@ var classMock = Mock.Create( - If `false` (default), the mock will return a default value (see `DefaultValue`). - If `true`, the mock will throw an exception when a method or property is called without a setup. - `SkipBaseClass` (bool): - - If `false` (default), the mock will call the base class implementation and use its return values as default values, if no - explicit setup is defined. + - If `false` (default), the mock will call the base class implementation and use its return values as default + values, if no explicit setup is defined. - If `true`, the mock will not call any base class implementations. - `Initialize(params Action>[] setups)`: - Automatically initialize all mocks of type T with the given setups when they are created. diff --git a/Docs/pages/02-setup.md b/Docs/pages/02-setup.md index 929f8541..1f0b130c 100644 --- a/Docs/pages/02-setup.md +++ b/Docs/pages/02-setup.md @@ -55,8 +55,10 @@ sut.SetupMock.Method.DispenseAsync(It.IsAny(), It.IsAny()) Mockolate provides flexible parameter matching for method setups and verifications: - `It.IsAny()`: Matches any value of type `T`. -- `It.Is(value)`: Matches a specific value. With `.Using(IEqualityComparer)`, you can provide a custom equality comparer. -- `It.IsOneOf(params T[] values)`: Matches any of the given values. With `.Using(IEqualityComparer)`, you can provide a custom equality comparer. +- `It.Is(value)`: Matches a specific value. With `.Using(IEqualityComparer)`, you can provide a custom equality + comparer. +- `It.IsOneOf(params T[] values)`: Matches any of the given values. With `.Using(IEqualityComparer)`, you can + provide a custom equality comparer. - `It.IsNull()`: Matches null. - `It.IsTrue()`/`It.IsFalse()`: Matches boolean true/false. - `It.IsInRange(min, max)`: Matches a number within the given range. You can append `.Exclusive()` to exclude the @@ -65,9 +67,15 @@ Mockolate provides flexible parameter matching for method setups and verificatio predicates. - `It.IsRef(…)`/`It.IsAnyRef(…)`: Matches and sets ref parameters, supports value setting and predicates. -- `It.Matches(pattern)`: Matches strings using wildcard patterns (`*` and `?`). With `.AsRegex()`, you can use regular expressions instead. +- `It.Matches(pattern)`: Matches strings using wildcard patterns (`*` and `?`). With `.AsRegex()`, you can use + regular expressions instead. - `It.Satisfies(predicate)`: Matches values based on a predicate. +When the method name is unique (no overloads), you can omit the argument matchers for simpler setups: + +- `Match.AnyParameters()`: Matches any parameters. +- `Match.Parameters(Func)`: Matches the parameters based on a predicate. + #### Parameter Interaction With `Do`, you can register a callback for individual parameters of a method setup. This allows you to implement side diff --git a/README.md b/README.md index 1371535b..c0160ff0 100644 --- a/README.md +++ b/README.md @@ -122,8 +122,7 @@ var classMock = Mock.Create( - If `true`, the mock will throw an exception when a method or property is called without a setup. - `SkipBaseClass` (bool): - If `false` (default), the mock will call the base class implementation and use its return values as default - values, if no - explicit setup is defined. + values, if no explicit setup is defined. - If `true`, the mock will not call any base class implementations. - `Initialize(params Action>[] setups)`: - Automatically initialize all mocks of type T with the given setups when they are created. @@ -224,6 +223,13 @@ Mockolate provides flexible parameter matching for method setups and verificatio regular expressions instead. - `It.Satisfies(predicate)`: Matches values based on a predicate. +When the method name is unique (no overloads), you can omit the argument matchers for simpler setups: + +- `Match.AnyParameters()`: Matches any parameters. +- `Match.Parameters(Func)`: Matches the parameters based on a predicate. + +```csharp + #### Parameter Interaction With `Do`, you can register a callback for individual parameters of a method setup. This allows you to implement side From b0d20444c27b5de6ccb37fefa3e324898dc986bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Wed, 21 Jan 2026 13:52:10 +0100 Subject: [PATCH 2/2] Review issues --- Docs/pages/02-setup.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/pages/02-setup.md b/Docs/pages/02-setup.md index 1f0b130c..0fd64d46 100644 --- a/Docs/pages/02-setup.md +++ b/Docs/pages/02-setup.md @@ -74,7 +74,7 @@ Mockolate provides flexible parameter matching for method setups and verificatio When the method name is unique (no overloads), you can omit the argument matchers for simpler setups: - `Match.AnyParameters()`: Matches any parameters. -- `Match.Parameters(Func)`: Matches the parameters based on a predicate. +- `Match.Parameters(Func predicate)`: Matches the parameters based on a predicate. #### Parameter Interaction diff --git a/README.md b/README.md index c0160ff0..183d0a8e 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ Mockolate provides flexible parameter matching for method setups and verificatio When the method name is unique (no overloads), you can omit the argument matchers for simpler setups: - `Match.AnyParameters()`: Matches any parameters. -- `Match.Parameters(Func)`: Matches the parameters based on a predicate. +- `Match.Parameters(Func predicate)`: Matches the parameters based on a predicate. ```csharp