C
C#7mo ago
uffen

learning moq framework

I'm trying to get my head around the moq framework but i can't seem to understand. Anyone got some good material for me to study it
10 Replies
jcotton42
jcotton427mo ago
Don’t use Moq. The dev slipped some shady shit into it a while back https://discord.com/channels/143867839282020352/276100951591616512/1138745496857489409
MODiX
MODiX7mo ago
TeBeCo
New version of MOQ will cause your builds to slow down A new version of popular mocking framework MOQ now includes SponsorLink which will * slow down/pause your builds in your IDE (not CI) if you do not sponsor the project. * forced build failures if you use warn as error * possibly be a violations of GDPR by collecting pii See more about MOQ issue: https://github.com/moq/moq/issues/1372 PR: https://github.com/moq/moq/pull/1373 Read more about sponsorlink here: https://www.cazzulino.com/sponsorlink.html This is being posted as it is widely-used and widely-impacts a large set of developers. It is not the purpose of this post to assume malice or negatively portrary the maintainer(s) of MOQ. Misc: there's other packages affected under the same maintainer and it organization such as: nugetizer ThisAssembly, Moq, ...
Quoted by
<@446416451230760990> from #newsfeed (click here)
From TeBeCo
React with ❌ to remove this embed.
SG97
SG977mo ago
NSubstitute could be an option
uffen
uffenOP7mo ago
Oh okay, got any other suggestions of similar frameworks to learn?
Pobiega
Pobiega7mo ago
NSubstitute it does the same thing, just with a different syntax the core idea is the same: you create a substitute or mock object of a certain interface. You then specify what a given method on that interface should return when called. lastly, you pass this object to your service under test
uffen
uffenOP7mo ago
Thank you, i will check it out
Auger
Auger7mo ago
Didn't they revert that though?
jcotton42
jcotton427mo ago
The dev that made the decision, kzu, is still committing. I don’t trust them.
PixxelKick
PixxelKick7mo ago
@uffen My recomendation is not used a mock library at all. Avoid mocking stuff entirely except for "on the edge" stuff. Most of which have built in easy ways to mock their data, IE HttpClient has a built in way to mock its response very easily, no library needed. Write code that doesn't need mocking. Once you get into that habit you'll find your tests become substantially easier to write too
PixxelKick
PixxelKick7mo ago
No description
Want results from more Discord servers?
Add your server