Skip to content

Instantly share code, notes, and snippets.

@Krizzzn
Created September 14, 2011 09:52
Show Gist options
  • Save Krizzzn/1216220 to your computer and use it in GitHub Desktop.
Save Krizzzn/1216220 to your computer and use it in GitHub Desktop.
VisualStudio: Test Method Snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>Test Method</Title>
<Shortcut>testm</Shortcut>
<Description>Code snippet for a test method</Description>
<Author>Microsoft Corporation and Krizzzn</Author>
</Header>
<Snippet>
<Imports>
<Import>
<Namespace>Microsoft.VisualStudio.TestTools.UnitTesting</Namespace>
</Import>
</Imports>
<References>
<Reference>
<Assembly>Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</Assembly>
</Reference>
</References>
<Declarations>
<Literal>
<ID>methodname</ID>
<ToolTip>Replace with the methodname of the method, you want to test</ToolTip>
<Default>MyMethod</Default>
</Literal>
<Literal>
<ID>name</ID>
<ToolTip>Replace with the name of the test method</ToolTip>
<Default>should_do_things</Default>
</Literal>
<Literal Editable="false">
<ID>TestMethod</ID>
<Function>SimpleTypeName(global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethod)</Function>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[[$TestMethod$]
public void $methodname$__$name$()
{
/// ARRANGE
$end$
/// ACT
/// ASSERT
}]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
@Krizzzn
Copy link
Author

Krizzzn commented Sep 14, 2011

Location in file System: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment