0

Is there any way to get dotCover to ignore a line of unreachable code

If I have code that can not be reached such as the exception below: 

enum ScriptType {
     None,     NewDBWithVersionTable,     PreScript,
     PostScript }

switch (scriptType)
{
  case ScriptType.None:
  case ScriptType.NewDBWithVersionTable:
    // do something
    break;

  case ScriptType.PreScript:
    // do something else
    break;

case ScriptType.PostScript:
    // do something different
    break;

default:
   // this wont run unless someone adds an enum
   throw new Exception ("Unhandled ScriptType - Someone added a new enum update required!!");

}  


Is there any way to make dotcover exclude the last line from its analysis?

I would like to be able to do something like:


//DotCoverIgnore
 default:
   // this wont run unless someone adds an enum
   throw new Exception ("Unhandled ScriptType - Someone added a new enum update required!!");
//EndDotCoverIgnore

Thanks
John

                      
 

4 comments

Please sign in to leave a comment.