-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from nunit/snippets
Snippets and templates
- Loading branch information
Showing
24 changed files
with
313 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
nunit.templates/ItemTemplates/Test/NUnit Setup Fixture/SetupFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using NUnit.Framework; | ||
using System; | ||
|
||
namespace $rootnamespace$ | ||
{ | ||
[SetUpFixture] | ||
public class $safeitemname$ | ||
{ | ||
[OneTimeSetUp] | ||
public void OneTimeSetUp() | ||
{ | ||
// TODO: Add code here that is run before | ||
// all tests in the assembly are run | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTearDown() | ||
{ | ||
// TODO: Add code here that is run after | ||
// all tests in the assembly have been run | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
nunit.templates/ItemTemplates/Test/NUnit Setup Fixture/SetupFixture.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Option Explicit On | ||
|
||
Imports System | ||
Imports NUnit.Framework | ||
|
||
Namespace $rootnamespace$ | ||
|
||
<SetUpFixture> | ||
Public Class $safeitemname$ | ||
|
||
<OneTimeSetUp> | ||
Public Sub OneTimeSetUp() | ||
' TODO Add code here that is run before | ||
' all tests in the assembly are run | ||
End Sub | ||
|
||
<OneTimeTearDown> | ||
Public Sub OneTimeTearDown() | ||
' TODO Add code here that is run after | ||
' all tests in the assembly have been run | ||
End Sub | ||
|
||
End Class | ||
|
||
End Namespace |
3 changes: 2 additions & 1 deletion
3
nunit.templates/ItemTemplates/Test/NUnit Test Fixture/Definitions/CSharp.vstemplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
nunit.templates/ItemTemplates/Test/NUnit Test Fixture/Definitions/VB.vstemplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
nunit.templates/ItemTemplates/Test/NUnit Test Fixture/TestClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using NUnit.Framework; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace $rootnamespace$ | ||
{ | ||
[TestFixture] | ||
public class $safeitemname$ | ||
{ | ||
[Test] | ||
public void TestMethod() | ||
{ | ||
// TODO: Add your test code here | ||
var answer = 42; | ||
Assert.That(answer, Is.EqualTo(42), "Some useful error message"); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
nunit.templates/ItemTemplates/Test/NUnit Test Fixture/TestClass.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Option Explicit On | ||
|
||
Imports System | ||
Imports NUnit.Framework | ||
|
||
Namespace $rootnamespace$ | ||
|
||
<TestFixture> | ||
Public Class $safeitemname$ | ||
|
||
<Test> | ||
Public Sub TestMethod() | ||
' TODO Add your test code here | ||
Dim answer = 42 | ||
Assert.That(answer, [Is].EqualTo(42), "Some useful error message") | ||
End Sub | ||
|
||
End Class | ||
|
||
End Namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// NUnit 3 tests | ||
// See documentation : https://github.com/nunit/docs/wiki/NUnit-Documentation | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
|
||
namespace $safeprojectname$ | ||
{ | ||
[TestFixture] | ||
public class $safeitemname$ | ||
{ | ||
[Test] | ||
public void TestMethod() | ||
{ | ||
// TODO: Add your test code here | ||
var answer = 42; | ||
Assert.That(answer, Is.EqualTo(42), "Some useful error message"); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
nunit.tests.core.csharp/_Definitions/_project.vstemplate.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project"> | ||
<TemplateData> | ||
<Name>NUnit 3 .NET Core Unit Test Project</Name> | ||
<Description>A project that contains .NET Core NUnit 3 unit tests (C#)</Description> | ||
<DefaultName>NUnit.Tests</DefaultName> | ||
<ProjectType>CSharp</ProjectType> | ||
<Category>CSharp</Category> | ||
<ProjectSubType></ProjectSubType> | ||
<SortOrder>1000</SortOrder> | ||
<CreateNewFolder>true</CreateNewFolder> | ||
<ProvideDefaultName>true</ProvideDefaultName> | ||
<PromptForSaveOnCreation>true</PromptForSaveOnCreation> | ||
<LocationField>Enabled</LocationField> | ||
<EnableLocationBrowseButton>true</EnableLocationBrowseButton> | ||
<!-- <Icon>nunit.png</Icon> --> | ||
<TemplateID>b0d3ff60-1340-4462-abf6-7d7cc9f175c5</TemplateID> | ||
<!-- Indicates how many parent folders this item template should appear in --> | ||
<NumberOfParentCategoriesToRollUp>0</NumberOfParentCategoriesToRollUp> | ||
<AppliesTo>CSharp</AppliesTo> | ||
<CreateInPlace>true</CreateInPlace> | ||
</TemplateData> | ||
<TemplateContent> | ||
<Project TargetFileName="NUnit.Tests.Core.csproj" File="NUnit.Tests.Core.CSharp.csproj" ReplaceParameters="true"> | ||
</Project> | ||
<CustomParameters> | ||
<CustomParameter Name = "$language$" Value="CSharp" /> | ||
</CustomParameters> | ||
|
||
</TemplateContent> | ||
<WizardExtension> | ||
<Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly> | ||
<FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName> | ||
</WizardExtension> | ||
<WizardData> | ||
<!-- <packages repository="extension" repositoryId="nunit.templates.b29e95b8-bf26-4f03-983d-f1d0f21ad6ef"> | ||
<package id="NUnit" version="3.11.0" /> | ||
<package id="NUnit3TestAdapter" version="3.13.0" /> | ||
<package id="Microsoft.NET.Test.Sdk" version="15.9.0" /> | ||
</packages> --> | ||
</WizardData> | ||
</VSTemplate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Preprocess> | ||
<!-- | ||
You can specify the path where this should show up in the | ||
Add New Project / Add New Item dialog by setting the value below | ||
--> | ||
<TemplateInfo Path="CSharp\Test"/> | ||
<Replacements Include="*.*" Exclude="*.vstemplate;*.fsproj;*.vbproj;*.jpg;*.png;*.ico;_preprocess.xml;_project.vstemplate.xml"> | ||
<add key="NUnit.Tests" value="$safeprojectname$"/> | ||
</Replacements> | ||
</Preprocess> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.11.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.11.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// NUnit 3 tests | ||
// See documentation : https://github.com/nunit/docs/wiki/NUnit-Documentation | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
|
||
namespace $safeprojectname$ | ||
{ | ||
[TestFixture] | ||
public class $safeitemname$ | ||
{ | ||
[Test] | ||
public void TestMethod() | ||
{ | ||
// TODO: Add your test code here | ||
var answer = 42; | ||
Assert.That(answer, Is.EqualTo(42), "Some useful error message"); | ||
} | ||
} | ||
} |
Oops, something went wrong.