C
C#4w ago
JellyRekt

TDD: Mocking services

Opinionated question, because I'm trying to decide how my team should proceed. Do y'all prefer to use a test double or a mocking framework, and why?
1 Reply
UnrealSPh
UnrealSPh4w ago
well... I'd defenetly suggest you to go with mocking framework. Most of them are simple to understand and learn how to use it. Additionally I think they force you to design your tests properly with good sections: setup action assert One really cool scenario I can see that if you have a logic when class A with method A has should call class B with method B, but calling method B will depend on some input params. And method B returns nothing (let's say it is a logger or something like this). And you need to write a test witch will check that that method B was called. With mocking you can setup your test even for this scenario without creating a lot of new abstractions.