Skip to content

Instantly share code, notes, and snippets.

@osmyn
Last active April 27, 2022 09:49
Show Gist options
  • Star 42 You must be signed in to star a gist
  • Fork 30 You must be signed in to fork a gist
  • Save osmyn/906c917653a30864cb52dee02c36c14e to your computer and use it in GitHub Desktop.
Save osmyn/906c917653a30864cb52dee02c36c14e to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Async Unit Test</Title>
<Author>Rusty Divine</Author>
<Description>Async Unit Test Template with 3 Parts</Description>
<HelpUrl>https://msdn.microsoft.com/en-us/library/ms165394.aspx</HelpUrl>
<SnippetTypes />
<Keywords />
<Shortcut>uat</Shortcut>
</Header>
<Snippet>
<References />
<Imports />
<Declarations>
<Literal Editable="true">
<ID>uow</ID>
<Type></Type>
<ToolTip>Name of the unit of work or scenario under test</ToolTip>
<Default>UoW</Default>
<Function></Function>
</Literal>
<Literal Editable="true">
<ID>initialcondition</ID>
<Type></Type>
<ToolTip></ToolTip>
<Default>InitialCondition</Default>
<Function></Function>
</Literal>
<Literal Editable="true">
<ID>expectedresult</ID>
<Type></Type>
<ToolTip>What your expected result is</ToolTip>
<Default>ExpectedResult</Default>
<Function></Function>
</Literal>
</Declarations>
<Code Language="csharp" Kind="method decl" Delimiter="$"><![CDATA[[TestMethod]
public async Task $uow$_$initialcondition$_$expectedresult$()
{
//Arrange
$end$
//Act
//Assert
}]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<?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</Title>
<Author>Rusty Divine</Author>
<Description>Unit Test Template with 3 Parts</Description>
<HelpUrl>https://msdn.microsoft.com/en-us/library/ms165394.aspx</HelpUrl>
<SnippetTypes />
<Keywords />
<Shortcut>ut</Shortcut>
</Header>
<Snippet>
<References />
<Imports />
<Declarations>
<Literal Editable="true">
<ID>uow</ID>
<Type></Type>
<ToolTip>Name of the unit of work or scenario under test</ToolTip>
<Default>UoW</Default>
<Function></Function>
</Literal>
<Literal Editable="true">
<ID>initialcondition</ID>
<Type></Type>
<ToolTip></ToolTip>
<Default>InitialCondition</Default>
<Function></Function>
</Literal>
<Literal Editable="true">
<ID>expectedresult</ID>
<Type></Type>
<ToolTip>What your expected result is</ToolTip>
<Default>ExpectedResult</Default>
<Function></Function>
</Literal>
</Declarations>
<Code Language="csharp" Kind="method decl" Delimiter="$"><![CDATA[[TestMethod]
public void $uow$_$initialcondition$_$expectedresult$()
{
//Arrange
$end$
//Act
//Assert
}]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
@FrederikSthenHansen
Copy link

Small addition (i'm sure Osmyn doesn't mind): To use the Async version of the unittest snippet type uat and hit and hit tab twice.

@osmyn
Copy link
Author

osmyn commented Nov 20, 2020

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