VS REGEX: Commenting Generated Assert Instructions

Visual Studio’s Unit Test generator generates a call to Assert.Inconclusive but, usually generates a call to another method of the Assert class. I find that very annoying because, some times, this makes the test fail instead of being reported as inconclusive.


To comment out these extra calls to Assert methods, the following regular expression can be used:


Find what:

{:b*}{Assert\.~(Inconclusive).*\n:b*Assert\.Inconclusive}

Replace with:

\1//\2

Check out the complete list.

2 thoughts on “VS REGEX: Commenting Generated Assert Instructions”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>