Comments (6)
Hi @drauch,
We don't currently have a mechanism to register global comparers (maybe it would be something to consider).
However, you could use An<Oid>.That.IsEqualTo(expectedOid, oidComparer)
.
I realize it's not as convenient, and isn't much simpler than what you currently have, but it's slightly better...
from fakeiteasy.
maybe it would be something to consider
I'm of 2 minds. I appreciate the power of our existing extension endpoints, and this would totally mirror an extension for formatting argument values, but I don't love how hard they are to discover.
Still, overall, I do like the idea. It might even be a way to implement an enumerable-comparing scheme that we've been throwing around in the back of our minds (which we should really make an issue for).
from fakeiteasy.
Thank you for the - as always - quick replies. Bummer, that this is not possible, but that's life ;-)
If you favor discoverability: it could be a method at the end of the call chain, e.g., MustHaveHappened().UsingArgumentEqualityComparers<Oid>(new OidComparer())
and in my solution I would build a MustHaveHappenedWithMyComparers() extension method that combines the two (though I really like the possibility to do that in a "hidden" way too).
Best regards,
D.R.
from fakeiteasy.
@drauch, I appreciate the idea of a MustHaveHappened().UsingArgumentEqualityComparers<Oid>(new OidComparer())
, but am not sure how it would buy you much over the solution you've come up with or that @thomaslevesque suggested. It would require a change to the library and still be pretty wordy. Granted, it's explicit, which is a nice feature, but we have explicit solutions that work with the current releases. Maybe I'm missing an advantage?
Perhaps I'm confused because I didn't understand
and in my solution I would build a MustHaveHappenedWithMyComparers() extension method that combines the two
Which two?
Regardless, I did create #1952 in case @thomaslevesque is also warm to the idea of the registry implicit argument comparers.
from fakeiteasy.
Maybe I'm missing an advantage?
It's better discoverable, but apart from that I don't like it much either.
Which two?
I'd hide MustHaveHappened().UsingArgumentEqualityComparers<Oid>(new OidComparer()).UsingArgumentEqualityComparer<Other>(new OtherComparer>()...
behind a MyMustHaveHappened()
extension method.
Regardless, I did create #1952 in case @thomaslevesque is also warm to the idea of the registry implicit argument comparers.
Great, I think we can close this issue then?
Best regards,
D.R.
from fakeiteasy.
Oh! I didn't realize you were proposing multiple UsingArgumentEqualityComparers
s tacked onto the end. Thanks. I understand the extension method now. Yeah, I prefer the implicit comparer to a chain of explicits too.
Great, I think we can close this issue then?
100% my goal in creating the new one. Thanks!
from fakeiteasy.
Related Issues (20)
- Match enumerable arguments by comparing contents rather than via `Equals` HOT 8
- Add assertion similar to Moq's `VerifyNoOtherCalls` HOT 8
- Feature request: ReturnsNextFromSequenceLazily() HOT 6
- Feature request: Then().Returns...() HOT 5
- Issue using Result Pattern and trying to fake a response
- Release 8.0.1 HOT 1
- Interface type property not return created object HOT 3
- How to fake a type that have `dynamic` (ExpandoObject) properties? HOT 3
- DoesNothing() and implicit creation options throws ArgumentException HOT 5
- Release 8.1.0 HOT 1
- Include README in NuGet package HOT 1
- Silence security vulnerability complaints over Microsoft.NETCore.App 2.1.0 HOT 2
- Release 8.2.0 HOT 1
- Fake does not work as argument constraint HOT 4
- Test fails on Version 8 but succeeds on Version 7 HOT 4
- Expose caught exception(s) in protected/abstract constructors HOT 10
- Invoke method after calling an Entities public method/behaviour HOT 7
- Release vNext
- Captured argument has empty Values HOT 6
- Document how to use InternalsVisibleTo from project files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fakeiteasy.