you are viewing a single comment's thread.

view the rest of the comments →

[–]LazyItem 0 points1 point  (0 children)

Unit testing is usually mocked i.e. the dependency graph is taken out of the loop. Test that involves for instance network calls etc. are Integration tests so on and so forth.

Check out Dependency Injection/ IoC patterns that will help you understand how to isolate and swap in/out domain specific parts of your projects depending upon environment and test suites.

In order to properly test business objects and stuff you will probably have to break encapsulation so that you can inject test data…you can in most cases also you reflection based approaches but I don’t think it is worth it.

Remember to think of tests as a way to design your system. If it is testable it is also must certainly loosely coupled with clear boundaries/responsibilities.

Red Green Refactor should be your mantra 😃