Wednesday, 24 November 2010

Visual Studio RegEx Find & Replace NUnit Assert

After fighting with Visual Studio's limited Regex format in the Find and Replace dialogue I've managed to work out how to use Find and Replace to remove warnings regarding some NUnit Assert... syntax:

Find what:
:bAssert\.IsInstanceOfType\(typeof\({.*}\)\,:b{.*}\);.*

Replace with:
Assert\.That( \2, Is\.InstanceOf< \1>())\;

This will replace obsolete syntax with the new format. Always do a test before you do a [Replace All] in your solution / project

No comments:

Post a Comment