mercredi 24 février 2016

Code Coverage and Regular Expressions (dotCover)

I am using dotCover to check my code coverage. At one line i am using a regular expression to check if a given string is valid.

if (!Regex.IsMatch(value, @"[a-zA-Z\-]"))
    throw new NullReferenceException("value");

I have created a unit test that checks if my code works as expected.

But dotCover doesnt recognize my code as covered. Sure because i dont test it with every possible (not matching) character.

What is a good solution for that problem?

Aucun commentaire:

Enregistrer un commentaire