Code Monkey home page Code Monkey logo

Comments (6)

thomaslevesque avatar thomaslevesque commented on June 2, 2024

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.

blairconrad avatar blairconrad commented on June 2, 2024

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.

drauch avatar drauch commented on June 2, 2024

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.

blairconrad avatar blairconrad commented on June 2, 2024

@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.

drauch avatar drauch commented on June 2, 2024

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.

blairconrad avatar blairconrad commented on June 2, 2024

Oh! I didn't realize you were proposing multiple UsingArgumentEqualityComparerss 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.