3 ms·
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 developm
by kumarvvr 5y ago
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.
- spaetzleesser 5y agoSome 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.
- culturedsystems 5y agoConstructor 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.
- spaetzleesser 5y ago“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.