Visual Studio/Resharper: Changing the order of arguments

We’ve recently run into some places in our tests where the expectation and actual values passed into NUnit’s ‘Assert.AreEqual’ are the wrong way round, therefore meaning that the error messages we get when tests fail are somewhat confusing!

Assert.AreEqual(theActualValue, "the expectation");

We can change the arguments around using Resharper by using the key combination ‘Ctrl-Alt-Shift-ArrowKey’ but you can only do this one line at a time which was a bit annoying as there were about 20 to change.

I got a bit bored of doing this after a while so I thought I’d look into whether it would be possible to do this with a ‘Find & Replace’.

After a bit of trial and error this is what I’ve ended up with:

Select all the areas of code that you want to change and press 'Ctrl-H'