Snippet for creating test method in VB.NET

· September 7, 2010

I’ve already posted this snippet in C#, but as I from time to time need it in VB.NET I’ll post that too. Here you go:

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="<http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>TestMethod</Title>
            <Shortcut>tm</Shortcut>
            <Description>Code snippet for creating a test method</Description>
            <Author>Marcusoft (www.marcusoft.net)</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>methodName</ID>
                    <ToolTip>The name of the test</ToolTip>
                    <Default>methodName</Default>
                </Literal>
            </Declarations>
            <Code Language="VB">
              <![CDATA[<TestMethod()> _
              Public Sub should\_$methodName$()
        ' Arrange

        ' Act

        ' Assert
        Assert.Fail("Implement test!")
    End Sub]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Twitter, Facebook