When writing automated tests I get tired of typing this over and over again:
[Test] public void when_foo_happens_then_bar() { //Arrange //Act //Assert }
So I made a ReSharper Live Template:
[Test] public void $NAME$() { //Arrange //Act //Assert Assert.Fail(); }
Now getting test definitions into the test class goes more like this:
“hmm, what should I test? How about,
testwhen_x_then_y
testwhen_i_then_j …”
With this template I found that not only do I saving typing time, but its also helped me brainstorm a bunch of tests quickly without distracting myself with the format.
You can type it yourself, or download it from github and import.
To Import: Resharper -> Tools -> Template Explorer -> Live Templates Tab -> Import button
UPDATE 6/6/2015: I have updated the template so that there is one for NUnit and another for the .NET Test Framework. Get the import file here: https://github.com/brentonc/bcutils/tree/master/ReSharper