.netc#-4.0ncover

NCover coverage is lower because of no coverage of the models. Improving ncover coverage.


Ncover coverage: There are classes in the project which are used like models(containing only properties). The code coverage for these is not there in the test cases. What is the general way of improving the coverage ?


Solution

  • If a class contains only properties (and I mean, truly properties, with only getters and setters that have no side effects), there is no need to test them. What would you test? There's nothing to do.

    For that reason, there's no need to provide code coverage for them, and your code coverage is fine. I don't worry about code coverage for pure properties, or constructors that simply assign to pure properties. It's a waste of time.

    Then again, that's my opinion. Your mileage may vary.