moq/moq4
### [`v4.16.0`](https://togithub.com/moq/moq4/blob/master/CHANGELOG.md#4160-2021-01-16)
[Compare Source](https://togithub.com/moq/moq4/compare/v4.15.2...v4.16.0)
##### Added
- Ability to directly set up the `.Result` of tasks and value tasks, which makes setup expressions more uniform by rendering dedicated async verbs like `.ReturnsAsync`, `.ThrowsAsync`, etc. unnecessary:
```diff
-mock.Setup(x => x.GetFooAsync()).ReturnsAsync(foo)
+mock.Setup(x => x.GetFooAsync().Result).Returns(foo)
```
This is useful in places where there currently aren't any such async verbs at all:
```diff
-Mock.Of(x => x.GetFooAsync() == Task.FromResult(foo))
+Mock.Of(x => x.GetFooAsync().Result == foo)
```
This also allows recursive setups / method chaining across async calls inside a single setup expression:
```diff
-mock.Setup(x => x.GetFooAsync()).ReturnsAsync(Mock.Of(f => f.Bar == bar))
+mock.Setup(x => x.GetFooAsync().Result.Bar).Returns(bar)
```
or, with only `Mock.Of`:
```diff
-Mock.Of(x => x.GetFooAsync() == Task.FromResult(Mock.Of(f => f.Bar == bar)))
+Mock.Of(x => x.GetFooAsync().Result.Bar == bar)
```
This should work in all principal setup methods (`Mock.Of`, `mock.Setup…`, `mock.Verify…`). Support in `mock.Protected()` and for custom awaitable types may be added in the future. ([@stakx](https://togithub.com/stakx), [#1126](https://togithub.com/moq/moq4/issues/1126))
##### Changed
- Attempts to mark conditionals setup as verifiable are once again allowed; it turns out that forbidding it (as was done in [#997](https://togithub.com/moq/moq4/issues/997) for version 4.14.0) is in fact a regression. ([@stakx](https://togithub.com/stakx), [#1121](https://togithub.com/moq/moq4/issues/1121))
##### Fixed
- Performance regression: Adding setups to a mock becomes slower with each setup ([@CeesKaas](https://togithub.com/CeesKaas), [#1110](https://togithub.com/moq/moq4/issues/1110))
- Regression: `mock.Verify[All]` no longer marks invocations as verified if they were matched by conditional setups. ([@Lyra2108](https://togithub.com/Lyra2108), [#1114](https://togithub.com/moq/moq4/issues/1114))
Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Enabled.
:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
4.15.2
->4.16.0
Release Notes
moq/moq4
### [`v4.16.0`](https://togithub.com/moq/moq4/blob/master/CHANGELOG.md#4160-2021-01-16) [Compare Source](https://togithub.com/moq/moq4/compare/v4.15.2...v4.16.0) ##### Added - Ability to directly set up the `.Result` of tasks and value tasks, which makes setup expressions more uniform by rendering dedicated async verbs like `.ReturnsAsync`, `.ThrowsAsync`, etc. unnecessary: ```diff -mock.Setup(x => x.GetFooAsync()).ReturnsAsync(foo) +mock.Setup(x => x.GetFooAsync().Result).Returns(foo) ``` This is useful in places where there currently aren't any such async verbs at all: ```diff -Mock.OfRenovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Enabled.
:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.