Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement It.Is, It.IsIn, It.IsNotIn with a comparer overload #1064

Merged
merged 1 commit into from Oct 1, 2020

Conversation

weitzhandler
Copy link
Contributor

Fixes #1059.

@weitzhandler weitzhandler force-pushed the it-is-comparer branch 3 times, most recently from 6fa0f44 to e3978f6 Compare September 29, 2020 07:41
@stakx stakx modified the milestones: 4.14.6, 4.15.0 Sep 29, 2020
Copy link
Contributor

@stakx stakx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! 👍

In addition to my review comments, please also add an entry to the CHANGELOG.md file, e.g. as follows:

 The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

+
+## Unreleased
+
+#### Added
+
+* New method overloads for `It.Is`, `It.IsIn`, and `It.IsNotIn` that compare values using a custom `IEqualityComparer<T>` (@weitzhandler, #1064)
+

 ## 4.14.5 (2020-07-01)

I've also included some review comments explicitly marked as "suggetions". If you choose not to follow them, I won't bother you about them again.

src/Moq/It.cs Outdated Show resolved Hide resolved
src/Moq/It.cs Outdated Show resolved Hide resolved
src/Moq/It.cs Outdated Show resolved Hide resolved
src/Moq/It.cs Outdated Show resolved Hide resolved
src/Moq/It.cs Outdated Show resolved Hide resolved
src/Moq/It.cs Outdated Show resolved Hide resolved
tests/Moq.Tests/CustomTypeMatchersFixture.cs Outdated Show resolved Hide resolved
tests/Moq.Tests/CustomTypeMatchersFixture.cs Outdated Show resolved Hide resolved
tests/Moq.Tests/CustomTypeMatchersFixture.cs Show resolved Hide resolved
tests/Moq.Tests/ItIsAnyTypeFixture.cs Outdated Show resolved Hide resolved
@weitzhandler weitzhandler force-pushed the it-is-comparer branch 3 times, most recently from 9e801e8 to 0cc2433 Compare September 30, 2020 00:38
src/Moq/It.cs Outdated Show resolved Hide resolved
@weitzhandler
Copy link
Contributor Author

Yikes, my last edit applied those formatting again! Lemme rever that back.

@weitzhandler
Copy link
Contributor Author

Ok fixed. Looks like it's ready to go. Thanks for your great effort @stakx, you're truly awesome!

@stakx
Copy link
Contributor

stakx commented Sep 30, 2020

Still looking good, yes!

FYI, it's probably going to take a few days until I'll merge this PR, as I'd like to first deal with #1061 and possibly do a patch release (4.14.6). This PR will go in 4.15.0 right afterward. 🚀

@weitzhandler
Copy link
Contributor Author

No worries, tx for the update, have a good one mate!

@stakx
Copy link
Contributor

stakx commented Sep 30, 2020

I'm afraid I caused a merge conflict in CHANGELOG.md. May I ask you to resolve it? (Keep both changes; your Unreleased section goes before the 4.14.6 that I just added.) Then I'll merge your PR.

@weitzhandler
Copy link
Contributor Author

Sure NP lemme rebase and merge.

@stakx stakx merged commit 7b2d74e into devlooped:master Oct 1, 2020
@stakx
Copy link
Contributor

stakx commented Oct 1, 2020

Thanks @weitzhandler – this collaboration has been a breeze and very enjoyable! 👌

@weitzhandler
Copy link
Contributor Author

🙏 looking forward, thank you!

@weitzhandler weitzhandler deleted the it-is-comparer branch October 1, 2020 07:41
mburumaxwell pushed a commit to faluapp/falu-dotnet that referenced this pull request Jun 12, 2021
Bumps [Moq](https://github.com/moq/moq4) from 4.14.7 to 4.15.2.

#Changelog

*Sourced from [Moq's changelog](https://github.com/moq/moq4/blob/master/CHANGELOG.md).*

> ## 4.15.2 (2020-11-26)
>
> #### Changed
>
> * Upgraded `System.Threading.Tasks.Extensions` dependency to version 4.5.4 (@JeffAshton, [#1108](devlooped/moq#1108))
>
>
> ## 4.15.1 (2020-11-10)
>
> #### Added
>
> * New method overloads for `It.Is`, `It.IsIn`, and `It.IsNotIn` that compare values using a custom `IEqualityComparer<T>` (@weitzhandler, [#1064](devlooped/moq#1064))
> * New properties `ReturnValue` and `Exception` on `IInvocation` to query recorded invocations return values or exceptions (@MaStr11, [#921](devlooped/moq#921), [#1077](devlooped/moq#1077))
> * Support for "nested" type matchers, i.e. type matchers that appear as part of a composite type (such as `It.IsAnyType[]` or `Func<It.IsAnyType, bool>`). Argument match expressions like `It.IsAny<Func<It.IsAnyType, bool>>()` should now work as expected, whereas they previously didn't. In this particular example, you should no longer need a workaround like `(Func<It.IsAnyType, bool>)It.IsAny<object>()` as originally suggested in [#918](devlooped/moq#918). (@stakx, [#1092](devlooped/moq#1092))
>
> #### Changed
>
> * Event accessor calls (`+=` and `-=`) now get consistently recorded in `Mock.Invocations`. This previously wasn't the case for backwards compatibility with `VerifyNoOtherCalls` (which got implemented before it was possible to check them using `Verify{Add,Remove}`). You now need to explicitly verify expected calls to event accessors prior to `VerifyNoOtherCalls`. Verification of `+=` and `-=` now works regardless of whether or not you set those up (which makes it consistent with how verification usually works). (@80O, @stakx, [#1058](devlooped/moq#1058), [#1084](devlooped/moq#1084))
> * Portable PDB (debugging symbols) are now embedded in the main library instead of being published as a separate NuGet symbols package (`.snupkg) (@kzu, [#1098](devlooped/moq#1098))
>
> #### Fixed
>
> * `SetupProperty` fails if property getter and setter are not both defined in mocked type (@stakx, [#1017](devlooped/moq#1017))
> * Expression tree argument not matched when it contains a captured variable &ndash; evaluate all captures to their current values when comparing two expression trees (@QTom01, [#1054](devlooped/moq#1054))
> * Failure when parameterized `Mock.Of<>` is used in query comprehension `from` clause (@stakx, [#982](devlooped/moq#982))
>
>
> ## 4.15.0
>
> This version was accidentally published as 4.15.1 due to an intermittent problem with NuGet publishing.

#Commits

- [`f2aa090`](devlooped/moq@f2aa090) ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New It.Is overload for matching values using custom IEqualityComparer
2 participants