All code visited but only 92% coverage
All code visited but only 92% coverage
Hello,
I am very new to ncover, and I have a weird thing happening. I have a method on an entity (all properties, and one validation method). Here is the method:
public void VerifyRequiredParameters()
{
if (string.IsNullOrEmpty(CallingSystem))
throw new ArgumentNullException("CallingSystem", "CallingSystem");
if (string.IsNullOrEmpty(SigningUserInfo.Ssn))
All the code lines in this method are blue, but the last curly brace is red. How the hell am I supposed to cover a curly brace in a unit test...?
throw new ArgumentException("SigningUserInfo.Ssn", "SigningUserInfo.Ssn");
if (string.IsNullOrEmpty(DocumentInfo.Base64Data))
throw new ArgumentException("DocumentInfo.Base64Data", "DocumentInfo.Base64Data");
if (string.IsNullOrEmpty(DocumentInfo.MimeType))
throw new ArgumentException("DocumentInfo.MimeType", "DocumentInfo.MimeType");
if (string.IsNullOrEmpty(DocumentInfo.ID))
throw new ArgumentException("DocumentInfo.ID", "DocumentInfo.ID");
if (DocumentInfo.MimeType.ToLowerInvariant() != "application/pdf"
&& DocumentInfo.MimeType.ToLowerInvariant() != "text/plain")
throw new ArgumentException("DocumentInfo.MimeType not valid. The only mime types allowed are \"application/pdf\" and \"text/plain\"", "DocumentInfo.MimeType");
}
All help is appreciated
Morten
RE: All code visited but only 92% coverage
is this in a debug build? sometimes in a debug build the compiler generates IL that can't be reached.
RE: All code visited but only 92% coverage
Yes it is a debug build. I'll try to run the coverage analysis on a release build on monday.
Thanks for the tip :)
RE: All code visited but only 92% coverage
not a problem :)