Skip to content

Instantly share code, notes, and snippets.

@rnarayana
Created October 7, 2018 06:20
Show Gist options
  • Save rnarayana/72f0b9cdacf4ad051bf934aaba936581 to your computer and use it in GitHub Desktop.
Save rnarayana/72f0b9cdacf4ad051bf934aaba936581 to your computer and use it in GitHub Desktop.
XUnit.Net Unit Test Snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>xUnit test method template</Title>
<Author>Narayana Rengaswamy</Author>
<Description>Adds a xUnit Test method</Description>
<Shortcut>xut</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>MethodUnderTest</ID>
<ToolTip>Replace with the method that is being tested.</ToolTip>
<Default>MethodUnderTest</Default>
</Literal>
<Literal>
<ID>TestCondition</ID>
<ToolTip>Replace with the condition.</ToolTip>
<Default>TestCondition</Default>
</Literal>
<Literal>
<ID>ExpectedResult</ID>
<ToolTip>Replace with the result that is expected.</ToolTip>
<Default>ExpectedResult</Default>
</Literal>
</Declarations>
<Code Language="CSharp">
<![CDATA[
[Fact]
public async Task $MethodUnderTest$_$TestCondition$_$ExpectedResult$()
{
//Arrange
//Act
//Assert
}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment