Merge pull request #3960 from jplebre/dotnet-new-nunit
Adds dotnet-new for nunit, similar to the xunit template
This commit is contained in:
commit
8cf16ce1eb
9 changed files with 136 additions and 29 deletions
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
|
||||
EndProject
|
||||
|
@ -121,6 +121,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Archive", "src\Microsoft.DotNet.Archive\Microsoft.DotNet.Archive.xproj", "{35B19F22-B8C0-4849-9C35-3F809B7588B8}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-new.Tests", "test\dotnet-new.Tests\dotnet-new.Tests.xproj", "{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -805,22 +807,6 @@ Global
|
|||
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
@ -901,6 +887,22 @@ Global
|
|||
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.Release|x64.Build.0 = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -953,11 +955,11 @@ Global
|
|||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{712A4AFF-D758-49B0-AB46-B6DD2FFC9D26} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
18
src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs
Normal file
18
src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using NUnit.Framework;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
public class Tests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test1()
|
||||
{
|
||||
Assert.Pass();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NUnit": "3.4.1",
|
||||
"dotnet-test-nunit": "3.4.0-beta-1"
|
||||
},
|
||||
|
||||
"testRunner": "nunit",
|
||||
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": "portable-net45+win8",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"version": "1.0.0",
|
||||
"type": "platform"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -96,7 +96,7 @@ namespace Microsoft.DotNet.Tools.New
|
|||
app.Description = "Initializes empty project for .NET Platform";
|
||||
app.HelpOption("-h|--help");
|
||||
|
||||
var csharp = new { Name = "C#", Alias = new[] { "c#", "cs", "csharp" }, TemplatePrefix = "CSharp", Templates = new[] { "Console", "Web", "Lib", "xunittest" } };
|
||||
var csharp = new { Name = "C#", Alias = new[] { "c#", "cs", "csharp" }, TemplatePrefix = "CSharp", Templates = new[] { "Console", "Web", "Lib", "xunittest", "nunittest" } };
|
||||
var fsharp = new { Name = "F#", Alias = new[] { "f#", "fs", "fsharp" }, TemplatePrefix = "FSharp", Templates = new[] { "Console", "Lib" } };
|
||||
|
||||
var languages = new[] { csharp, fsharp };
|
||||
|
|
|
@ -32,6 +32,7 @@ Type of the project. Valid values for C# are:
|
|||
* `web`
|
||||
* `lib`
|
||||
* `xunittest`
|
||||
* `nunittest`
|
||||
|
||||
Valid values for F# are:
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"commands/dotnet-new/CSharp_Lib.zip",
|
||||
"commands/dotnet-new/CSharp_xunittest.zip",
|
||||
"commands/dotnet-new/CSharp_Web.zip",
|
||||
"commands/dotnet-new/CSharp_nunittest.zip",
|
||||
"commands/dotnet-new/FSharp_Console.zip",
|
||||
"commands/dotnet-new/FSharp_Lib.zip"
|
||||
]
|
||||
|
@ -19,7 +20,8 @@
|
|||
"commands/dotnet-new/CSharp_Web/**",
|
||||
"commands/dotnet-new/CSharp_Lib/**",
|
||||
"commands/dotnet-new/FSharp_Lib/**",
|
||||
"commands/dotnet-new/CSharp_xunittest/**"
|
||||
"commands/dotnet-new/CSharp_xunittest/**",
|
||||
"commands/dotnet-new/CSharp_nunittest/**"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
49
test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs
Normal file
49
test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace Microsoft.DotNet.Tests
|
||||
{
|
||||
[Collection("'dotnet test' collection")]
|
||||
public class GivenThatIWantANewCSnUnitProject : TestBase
|
||||
{
|
||||
|
||||
[Fact]
|
||||
public void When_nUnit_project_created_Then_project_restores()
|
||||
{
|
||||
var rootPath = Temp.CreateDirectory().Path;
|
||||
|
||||
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
||||
.Execute("new --type nunittest")
|
||||
.Should()
|
||||
.Pass();
|
||||
|
||||
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
||||
.Execute("restore")
|
||||
.Should().Pass();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void When_dotnet_test_is_invoked_Then_tests_run_without_errors()
|
||||
{
|
||||
var rootPath = Temp.CreateDirectory().Path;
|
||||
|
||||
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
||||
.Execute("new --type nunittest");
|
||||
|
||||
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
||||
.Execute("restore");
|
||||
|
||||
var buildResult = new TestCommand("dotnet")
|
||||
.WithWorkingDirectory(rootPath)
|
||||
.ExecuteWithCapturedOutput("test")
|
||||
.Should()
|
||||
.Pass()
|
||||
.And
|
||||
.NotHaveStdErr();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,13 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Xunit;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace Microsoft.DotNet.Tests
|
||||
{
|
||||
[Collection("'dotnet test' collection")]
|
||||
public class GivenThatIWantANewCSxUnitProject : TestBase
|
||||
{
|
||||
|
||||
|
@ -20,7 +15,6 @@ namespace Microsoft.DotNet.Tests
|
|||
public void When_xUnit_project_created_Then_project_restores()
|
||||
{
|
||||
var rootPath = Temp.CreateDirectory().Path;
|
||||
var projectJsonFile = Path.Combine(rootPath, "project.json");
|
||||
|
||||
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
||||
.Execute("new --type xunittest")
|
||||
|
@ -52,7 +46,5 @@ namespace Microsoft.DotNet.Tests
|
|||
.And
|
||||
.NotHaveStdErr();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
21
test/dotnet-new.Tests/dotnet-new.Tests.xproj
Normal file
21
test/dotnet-new.Tests/dotnet-new.Tests.xproj
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>712a4aff-d758-49b0-ab46-b6dd2ffc9d26</ProjectGuid>
|
||||
<RootNamespace>dotnet-new.Tests</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue