English Article · Software

Things to avoid and apply for better unit-test coverage

Code implementation which potentially decrease code coverage in your code or makes it hard to test:

  • Static methods.
  • Static classes (including Singleton).
  • Constructors with the new keyword.
  • Extension methods.

Approaches which help to test your code better:

  • Interface usage.
  • Dependency Injection.
  • Inversion of Control.
  • Fabric design pattern.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.