2010-07-27 64 views
2

什麼是您每天使用的Resharper的一些有用的實時模板?有用的Resharper Live模板?

+0

對不起菲利普,有一個爲IL :) – 2010-07-29 21:40:21

+0

沒有活的模板,我知道。我不需要用於IL的模板; Console.WriteLine和ILdasm是我所需要的:) – plaureano 2010-08-04 10:30:03

+2

[你使用什麼ReSharper 4.0實時模板C#的可能的重複?](http://stackoverflow.com/questions/186970/what-resharper-4-0-live -templates-for-c-do-you-use) – 2010-08-11 07:08:30

回答

0

我有一個自定義模板來創建我一直使用的測試方法。

[Test] 
public void $TEST_NAME$() {$END$} 

並且還與創建測試夾具的自定義文件模板結合使用。

using NBehave.Spec.NUnit; 
using NUnit.Framework; 
using Moq; 

namespace $NAMESPACE$ 
{ 
    [TestFixture] 
    public class $CLASS$ : TestBase 
    { 
     $END$ 
    } 
} 
4

我使用的實時模板一大堆(> 1000)創造通用結構一拉的CodeRush的。你可以找到他們here

+3

模板鏈接已死 – JJS 2015-04-12 23:05:32

0

這樣可以節省一些打字對我來說,它創建了一個NUnit的測試用例存根處理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)); 
} 
}