Skip to content

Instantly share code, notes, and snippets.

@dburriss
Created June 28, 2017 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dburriss/9f7e3a46f030aab706304a7bc01433e4 to your computer and use it in GitHub Desktop.
Save dburriss/9f7e3a46f030aab706304a7bc01433e4 to your computer and use it in GitHub Desktop.
An XUnit fact snippet for Visual Studio. Navigate to Tool > Code Snippets Manager... (or press Ctrl+K, Ctrl+B)
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>XUnit Fact method</Title>
<Author>Devon Burriss</Author>
<Description>Creates a method that will run as an XUnit test (fact).</Description>
<Shortcut>fact</Shortcut>
</Header>
<Imports>
<Import>
<Namespace>Xunit</Namespace>
</Import>
</Imports>
<Snippet>
<Declarations>
<Literal>
<ID>unit</ID>
<ToolTip>Name of the unit under test.</ToolTip>
<Default>Unit</Default>
</Literal>
<Literal>
<ID>scenario</ID>
<ToolTip>Scenario this test exercises.</ToolTip>
<Default>Scenario</Default>
</Literal>
<Literal>
<ID>expected</ID>
<ToolTip>Expected result of this test.</ToolTip>
<Default>Expected</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[
[Fact]
public void $unit$_$scenario$_$expected$()
{
$end$
}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment