Custom patterns with Resharper are cool. And can help you and your team to make your code more uniform. I know me and my team are using them ;-).

The human brain works in such a way that it will filter out any information it knows or thinks it knows. You know that text without the vowls that you can read without a problem because your brain just knows what should be there. Ths s txt wtht vwls. Pretty sure you can read what I meant there. So the more you make something uniform the faster your brain will be able to skim over a certain text.

Now in NUnit these statements

vb.net
1
2
3
Assert.AreEqual(True, "string".Contains("s"))
Assert.AreEqual(false, "string".Contains("k"))
Assert.AreEqual("", "")
Assert.AreEqual(True, "string".Contains("s"))
Assert.AreEqual(false, "string".Contains("k"))
Assert.AreEqual("", "")

are the same as these statements

vb.net
1
2
3
Assert.IsTrue("string".Contains("s"))
Assert.IsFalse("string".Contains("k"))
Assert.IsEmpty("")
Assert.IsTrue("string".Contains("s"))
Assert.IsFalse("string".Contains("k"))
Assert.IsEmpty("")

I prefer the bottom one because less code is less bugs (maybe).

So I set about to create custom patterns in Resharper 6.

I made 3.

One for The IsTrue thing.

One for the IsFalse thing

One for the IsEmpty String.

I will now recieve a suggestion saying I should better use IsFalse, IsTrue or IsEmpty where appropriate.

And I can do the Alt+Enter thing.

Rules are important in a team, a way to make it easier to enforce them is helpful.

That does not mean that rules shoud be made into a religion.