Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why aren't these lines getting covered by code coverage?

I'm using Visual Studio 2010's code coverage feature. I've made several unit tests to test a method, but the code coverage is telling me that three blocks are not getting completely covered. The problem is, I don't see how these blocks can be only partially covered. Notice that the return statements ARE covered, so clearly the branch has been taken. Any ideas?

enter image description here

like image 699
heneryville Avatar asked Mar 20 '12 14:03

heneryville


1 Answers

The answer turned out to be that endDate is nullable. Even though I handle null cases at the top, the code coverage wanted to see the null situation delt with at each branch with endDate in it.

like image 87
heneryville Avatar answered Nov 15 '22 07:11

heneryville