Re:Mocking Is an Anti-Pattern
by smackeyacky on Monday June 17, 2024 @06:51PM
(#40712092)
I can think of a few things that will upset this particular apple cart, chief amongst them is the behaviour of different databases and sorting / collation which might not be generally categorised as the kind of bug a test suite will uncover, but certainly creates production bugs / issues.
I love EntityFramework, it's easily the best ORM I have ever used but it has a few cross-platform footguns that require testing against the actual database service you're using.
Re:Mocking Is an Anti-Pattern
by alexfromapex on Monday June 17, 2024 @08:17PM
(#40712732)
If you need to test collation or some database implementation detail, that is the exception where it may be good to use a real database but certainly is not the rule.
Re:Mocking Is an Anti-Pattern
by Foobar8568 on Tuesday June 18, 2024 @01:08AM
(#40714238)
Collation, localization ( Switzerland is a mess on .Net, I don't want to imagine other frameworks) etc.
I ended up a few times with discrepancy in the format (excel, .net and windows ) because someone changed it.
The same logic does not apply to all ORMs, of course, which do not all benefit from the same quality of professional dev support that EF receives from MS. But that's my main point from above: the correct design decision depends on the context. For services written in other languages with other ORMs or raw SQL, I absolutely will spin up a full Postgres test container because it is indeed trivial (have one running in the background on my laptop right now in fact). It just isn't necessary in the specific context of EntityFramework code.