Reputation: 3279
What are some useful live templates for Resharper that you use on a daily basis?
Upvotes: 2
Views: 869
Reputation: 23789
I use a whole host (>1000) of live templates for creation of general-purpose structures a la CodeRush. You can find them here
Upvotes: 4
Reputation: 17580
This saves some typing for me, it creates a NUnit TestCase stub that handles exceptioncases:
[TestCase("arg1", "arg2", "expected", typeof(Exception))]
public void $TestName$(string $arg1$ , string $arg2$, string $expected$, Type expectedExceptionType)
{
if(expectedExceptionType!=null)
{
Assert.Throws(expectedExceptionType, () =>
{
Console.Out.WriteLine("Do something to trigger exception here!");
});
}
else
{
Assert.That("actual", Is.EqualTo(expected));
}
}
Upvotes: 0
Reputation: 4170
I have a custom template for creating test methods that I use all the time.
[Test]
public void $TEST_NAME$() {$END$}
And also in conjunction with a custom file template for creating the test fixture.
using NBehave.Spec.NUnit;
using NUnit.Framework;
using Moq;
namespace $NAMESPACE$
{
[TestFixture]
public class $CLASS$ : TestBase
{
$END$
}
}
Upvotes: 0