Added snippet for testcasesource

This commit is contained in:
Terje Sandstrom 2019-03-08 10:59:11 +01:00
Родитель 626fc90c0d
Коммит c72e691c5b
3 изменённых файлов: 56 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>NUnit TestCaseSource Method</Title>
<Author>Terje Sandstrom</Author>
<Description>Code snippet for a testcasesource method</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>ntestcasesource</Shortcut>
</Header>
<Snippet>
<Imports>
<Import>
<Namespace>NUnit.Framework</Namespace>
</Import>
</Imports>
<References>
<Reference>
<Assembly>nunit.framework.dll</Assembly>
</Reference>
</References>
<Declarations>
<Literal Editable="true">
<ID>name</ID>
<ToolTip>Replace with the name of the test method</ToolTip>
<Default>ThatDataIsGreaterThanZero</Default>
<Function>
</Function>
</Literal>
<Literal Editable="false">
<ID>TestCaseSource</ID>
<ToolTip>
</ToolTip>
<Default>
</Default>
<Function>SimpleTypeName(global::NUnit.Framework.TestCaseSource)</Function>
</Literal>
</Declarations>
<Code Language="csharp" Delimiter="$"><![CDATA[
// Read more https://github.com/nunit/docs/wiki/TestCaseSource-Attribute
static readonly List<int> MyTestCaseSource = new List<int> {1,2,3,4 };
[$TestCaseSource(nameof(MyTestCaseSource))$]
public void $name$(int someData)
{
Assert.That(someData, Is.GreaterThab(0), "Some useful error message");$end$
}]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

Просмотреть файл

@ -149,6 +149,7 @@
<SubType>Designer</SubType>
</None>
<None Include="Snippets\CSharp\NUnit\nteardown.snippet" />
<None Include="Snippets\CSharp\NUnit\ntestcasesource.snippet" />
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="nunit.templates.b29e95b8-bf26-4f03-983d-f1d0f21ad6ef" Version="1.4.13" Language="en-US" Publisher="Rob Prouse" />
<Identity Id="nunit.templates.b29e95b8-bf26-4f03-983d-f1d0f21ad6ef" Version="1.4.15" Language="en-US" Publisher="Rob Prouse" />
<DisplayName>NUnit VS Templates</DisplayName>
<Description xml:space="preserve">Provides Visual Studio project and item templates for NUnit 3 along with code snippets.</Description>
<MoreInfo>https://github.com/nunit/nunit-vs-templates</MoreInfo>