3 ms·
Practical advice? Consider making every type internal. Then open them up to what is strictly required to be public. Now you are testing the behaviour of your a
by ed_blackburn 9y ago
Practical advice? Consider making every type internal. Then open them up to what is strictly required to be public.
Now you are testing the behaviour of your application through its public surface. This reduces the brittleness of your tests because you can change the internal implementation without rewriting your tests. You have higher assurance. It'll also force your hand to enforce invariants and place guard clauses in the right places rather than "everywhere".
If you follow Cockburn's Ports and Adapters approach too, then you can substitute adapters like persistent state, buses, HTTP clients for appropriate in-memory equivalents.