Created
December 21, 2016 01:46
-
-
Save sionjlewis/91934e7ab43b967a76db9637b3201b28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>Unit Test Async Method</Title> | |
<Author>Siôn J. Lewis</Author> | |
<Description>Adds an async unit test method with comments based on the AAA (Arrange,Act,Assert) pattern</Description> | |
<HelpUrl>https://msdn.microsoft.com/en-us/library/ms165394.aspx</HelpUrl> | |
<Shortcut>utestasync</Shortcut> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal Editable="true"> | |
<ID>MethodName</ID> | |
<ToolTip>Method name: e.g. IsStrawberryRed</ToolTip> | |
<Default>MethodName</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>Condition</ID> | |
<ToolTip>Condition: e.g. WhenRipe</ToolTip> | |
<Default>Condition</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>ExpectedResult</ID> | |
<ToolTip>Expected result: e.g. True</ToolTip> | |
<Default>ExpectedResult</Default> | |
<Function> | |
</Function> | |
</Literal> | |
</Declarations> | |
<Code Language="CSharp" Kind="method decl"><![CDATA[[TestMethod] | |
public async Task $MethodName$_$Condition$_$ExpectedResult$() | |
{ | |
// Arrange | |
$end$ | |
// Act | |
var result = await Task.FromResult<object>(null); | |
// Assert | |
Assert.Fail(); | |
}]]></Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based upon my original UnitTestMethod.Snippet Gist, this C# Code Snippet can be used within Visual Studio to generates Async Unit Test Methods (Functions).
How to Use