Feed Subscribe
Exception has been thrown by the target of an invocation.

Visual Studio and Resharper snippet for MSTest method

by ondrejsv 18. May 2011 22:28

Visual Studio comes with an OOTB MSTest method snippet accessible via the testm shortcut. Two thing missing in it for me:

  1. standard naming convention as mentioned also in the The Art of Unit Testing by Roy Oshrove (TestedMethod_StateUnderTest_ExpectedResult),
  2. separation of Arrange, Act and Assert parts of the code by clearly visible comments.

I’ve been observing that VS code snippets are for not widely used some reason. Perhaps the clunky Snippet Manager in Visual Studio or necessity to edit snippets in XML by hand… who knows…

So here’s how looks my new snippet:


Trivial as it is but useful very much.

Download clean VS version or ReSharper snippet (aka Live Template).


Comments are closed