Skip to content

Instantly share code, notes, and snippets.

@costr
Last active November 15, 2021 05:11
Show Gist options
  • Save costr/b580de2e290a92009fad31af7951824c to your computer and use it in GitHub Desktop.
Save costr/b580de2e290a92009fad31af7951824c to your computer and use it in GitHub Desktop.
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>
<Title>Test Method - Base</Title>
<Author>Adam Costenbader</Author>
<Description>Use to define the base structure of a test method.</Description>
<Shortcut>btest</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[
[TestMethod]
public void $WhatThing$_$WhatAction$_$WhatResult$()
{
// Arrange
// Act
// Assert
}
]]>
</Code>
<Declarations>
<Literal>
<ID>WhatThing</ID>
<ToolTip>What function or object are you testing?</ToolTip>
<Default>WhatFunctionOrObjectYouAreTesting</Default>
</Literal>
<Literal>
<ID>WhatAction</ID>
<ToolTip>What action do you want to test?</ToolTip>
<Default>WhatThingYouAreTesting</Default>
</Literal>
<Literal>
<ID>WhatResult</ID>
<ToolTip>What is the expected result of the test?</ToolTip>
<Default>TheExpectedResultOfTheTest</Default>
</Literal>
</Declarations>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment