diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index eec268d1b..caa244ff9 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -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 diff --git a/src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs b/src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs new file mode 100644 index 000000000..ab4cf8ec5 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/CSharp_nunittest/Tests.cs @@ -0,0 +1,18 @@ +using NUnit.Framework; + +namespace Tests +{ + public class Tests + { + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/CSharp_nunittest/project.json.template b/src/dotnet/commands/dotnet-new/CSharp_nunittest/project.json.template new file mode 100644 index 000000000..bb414fa52 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/CSharp_nunittest/project.json.template @@ -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" + } + } + } + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-new/Program.cs b/src/dotnet/commands/dotnet-new/Program.cs index 106429bf4..8cf8dffab 100644 --- a/src/dotnet/commands/dotnet-new/Program.cs +++ b/src/dotnet/commands/dotnet-new/Program.cs @@ -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 }; diff --git a/src/dotnet/commands/dotnet-new/README.md b/src/dotnet/commands/dotnet-new/README.md index 117edacb7..f795cb6c0 100644 --- a/src/dotnet/commands/dotnet-new/README.md +++ b/src/dotnet/commands/dotnet-new/README.md @@ -32,6 +32,7 @@ Type of the project. Valid values for C# are: * `web` * `lib` * `xunittest` +* `nunittest` Valid values for F# are: diff --git a/src/dotnet/project.json b/src/dotnet/project.json index b75006cb2..66ee8dd68 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -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/**" ] } }, diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs new file mode 100644 index 000000000..e03168e26 --- /dev/null +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSnUnitProject.cs @@ -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(); + } + } +} diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs index 777e03eea..2163c5f89 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs @@ -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(); } - - } } diff --git a/test/dotnet-new.Tests/dotnet-new.Tests.xproj b/test/dotnet-new.Tests/dotnet-new.Tests.xproj new file mode 100644 index 000000000..eddc88c4a --- /dev/null +++ b/test/dotnet-new.Tests/dotnet-new.Tests.xproj @@ -0,0 +1,21 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 712a4aff-d758-49b0-ab46-b6dd2ffc9d26 + dotnet-new.Tests + .\obj + .\bin\ + + + 2.0 + + + + + + \ No newline at end of file