News for hackers. Stuff that matters.
Re:.NET Myths Dispelled by kumarvvr on Sunday March 13, 2022 @01:33AM (#30658543)
Sorry, if tests are not adaptable to changing code, why are they called tests?

I thought tesring was to check software,not be a constraint on software development.

Also, I think using DI in the test process itself will mitigate the issue.

Re:.NET Myths Dispelled by spaetzleesser on Sunday March 13, 2022 @08:29AM (#30660657)
Some tests are not adaptable to changing code because of the way MS uses DI. A lot of DI is done by adding new parameters to the constructor.

It’s the same with async. Needing an async function somewhere can result in a huge cascade of changes.

Re:.NET Myths Dispelled by culturedsystems on Sunday March 13, 2022 @10:19AM (#30661413)
Constructor inject is generally a positive here, though, as the compiler will tell you where you need to add the new dependency. If you find that you have to add the dependency in lots of places just to satisfy the compiler, not because the functionality actually requires the dependency, that's usually a sign the class should be broken up into classes with more clearly defined responsibilities.
Re:.NET Myths Dispelled by spaetzleesser on Sunday March 13, 2022 @12:41PM (#30662965)
“If you find that you have to add the dependency in lots of places just to satisfy the compiler, not because the functionality actually requires the dependency, that's usually a sign the class should be broken up into classes with more clearly defined responsibilities.”

Sure in theory this is correct but you can’t always anticipate future needs. The class may still have very clearly defined responsibility but it just needs another piece of information that you can get only with DI. I feel this over dependence on DI in .NET forces you to design around the framework and not around what makes sense.