什么是ReSharper 4+;C#的实时模板您使用吗?
您使用什么ReSharper 4.0模板来制作C 让我们以以下格式共享这些内容:什么是ReSharper 4+;C#的实时模板您使用吗?,c#,templates,refactoring,resharper,C#,Templates,Refactoring,Resharper,您使用什么ReSharper 4.0模板来制作C 让我们以以下格式共享这些内容: [标题] 可选描述 快捷方式:快捷方式 在以下位置可用:[可用性设置] // Resharper template code snippet // comes here 宏属性(如果存在): 宏1-值-可编辑发生 宏2-值-可编辑发生 请给每个答案一个宏 以下是和的一些示例,它们以建议的格式描述了活动模板 为某些类型创建新的单元测试夹具 快捷方式:ntf 可在以下文件中找到:C#2.0+文件,其中允许类
[标题] 可选描述 快捷方式:快捷方式
在以下位置可用:[可用性设置]
// Resharper template code snippet
// comes here
宏属性(如果存在):
- 宏1-值-可编辑发生
- 宏2-值-可编辑发生
- 请给每个答案一个宏李>
- 以下是和的一些示例,它们以建议的格式描述了活动模板
可在以下文件中找到:C#2.0+文件,其中允许类型成员声明或命名空间声明
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏:
- 类型测试-无-#2
- 测试-无-V
可在以下文件中找到:C#2.0+文件,其中允许类型成员声明
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏:
- 测试-无-V
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏属性:
- 成员-建议System.IDisposable的变量-可编辑事件#1
- 类-包含类型名称
可在以下文件中找到:C#2.0+文件,其中允许类型成员声明
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
创建健全性检查以确保参数从不为空
快捷方式:eann可在以下文件中找到:C#2.0+文件,其中允许使用类型语句
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏:
- 内部-建议参数-#1
可在以下文件中找到:C#2.0+文件,其中允许使用语句
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏属性:
- 参数-
-可编辑发生值
- 掩码-
-可编辑发生“{0}”
在中提供:在允许使用语句的C#2.0+文件中
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
流畅版本:
Assert.That($expected$, Is.EqualTo($actual$));$END$
新COM类
快捷方式:comclass
在允许类型成员声明或命名空间声明的:C#2.0+文件中提供
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏
- GUID-新GUID
- 名称-可编辑
- 界面-可编辑
Control
实现ISynchronizeInvoke
快捷方式:ani
中提供:允许使用C#2.0+文件语句
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏
- SYNC\u INVOKE-建议
System.ComponentModel.ISynchronizeInvoke的变量
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏
- 方法\u名称-包含类型成员名称
您通常会将此模板用作给定方法中的第一条语句,其结果类似于:
void DoSomething(Type1 arg1)
{
if (InvokeRequired)
{
Invoke((Action)delegate { DoSomething(arg1); });
return;
}
// Rest of method will only execute on the correct thread
// ...
}
MST试验方法
这有点蹩脚,但很有用。希望有人能从中得到一些有用的东西
快捷方式:testMethod
提供版本:C#2.0
快速预期异常快捷方式
只是一个快速添加到我的单元测试属性的快捷方式
快捷方式:ee
在中可用:在允许类型成员声明的:C#2.0+文件中可用
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
为当前类型声明log4net记录器 快捷方式:日志 可在以下文件中找到:C#2.0+文件,其中允许类型成员声明
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
宏属性:
- 类型-包含类型名称
在以下文件中可用:在允许类型成员声明的:C#2.0+文件中可用
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
努尼特拆卸法
快捷方式:拆卸在以下文件中可用:在允许类型成员声明的:C#2.0+文件中可用
[NUnit.Framework.TestFixtureAttribute]
public sealed class $TypeToTest$Tests
{
[NUnit.Framework.TestAttribute]
public void $Test$()
{
var t = new $TypeToTest$()
$END$
}
}
[NUnit.Framework.TestAttribute]
public void $Test$()
{
$END$
}
public void Dispose()
{
Dispose(true);
System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
if ($MEMBER$ != null)
{
$MEMBER$.Dispose();
$MEMBER$ = null;
}
}
disposed = true;
}
}
~$CLASS$()
{
Dispose(false);
}
private bool disposed;
[Test, Ignore]
public void $TestName$()
{
throw new NotImplementedException();
}
$END$
Enforce.ArgumentNotNull($inner$, "$inner$");
Trace.WriteLine(string.Format("$MASK$",$ARGUMENT$));
Assert.AreEqual($expected$, $actual$);$END$
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("$GUID$")]
public class $NAME$ : $INTERFACE$
{
$END$
}
Debug.Assert(!$SYNC_INVOKE$.InvokeRequired, "InvokeRequired");
if (InvokeRequired)
{
Invoke((System.Action)delegate { $METHOD_NAME$($END$); });
return;
}
[ExpectedException(typeof($TYPE$))]
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($TYPE$));
[NUnit.Framework.SetUp]
public void SetUp()
{
$END$
}
[NUnit.Framework.TearDown]
public void TearDown()
{
$END$
}
[TestMethod]
public void $MethodName$_$StateUnderTest$_$ExpectedBehavior$()
{
// Arrange
$END$
// Act
// Assert
}
System.Console.WriteLine("Press <ENTER> to exit...");
System.Console.ReadLine();$END$
virtual $END$
public static readonly System.Windows.DependencyProperty $PropertyName$Property =
System.Windows.DependencyProperty.Register("$PropertyName$",
typeof ($PropertyType$),
typeof ($OwnerType$));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
$END$
检查变量是否为空
快捷方式:ifn可在以下文件中找到:C#2.0+文件
if (null == $var$)
{
$END$
}
if (null != $var$)
{
$END$
}
new System.Guid("$GUID$")
检查变量是否不为空
快捷方式:ifnn可在以下文件中找到:C#2.0+文件
if (null == $var$)
{
$END$
}
if (null != $var$)
{
$END$
}
new System.Guid("$GUID$")
新型模拟隔离器
快捷方式:假可在以下文件中找到:[在允许使用语句的c#2.0文件中] $TYPE$$Name$Fake=Isolate.Fake.Instance()
孤立.当调用(()=>$Name$false) 宏属性: