justin-millman / Kvasir

A non-invasive object-relational mapping framework for a variety of back-end database providers
GNU General Public License v3.0
0 stars 1 forks source link

Replace Moq with NSubstitute #84

Closed justin-millman closed 1 year ago

justin-millman commented 1 year ago

There's some controversy surrounding Moq right now: basically, one of the principal maintainers added a dependency to a different, not-quite-open-source project, and it appears that the dependency does some e-mail address scraping. The community is unhapppy; see https://github.com/moq/moq/issues?q=SponsorLink for a BUNCH of issues on Moq's GitHub page related to this.

I'm not 100% sure if the new dependency (SponsorLink) is an issue or not, but I'm a little uncomfortable upgrading. So instead, like many, I'm replacing Moq with NSusbtitute. Turns out, NSubstitute is a better mocking framework anyway! It's a lot more intuitive to use, and it has built-in support for call sequences (allowing me to delete my home-baked version needed for Moq). All the tests transitioned fairly easily, though NSubstitute does have issues mocking e.g. object.Equals(object), so the IsSameSequence matcher tests had to be tweaked slightly.