diff --git a/src/dotnet/commands/dotnet-new/CSharp_Lib/project.json.template b/src/dotnet/commands/dotnet-new/CSharp_Lib/project.json.template index 8b0aefe2a..a4b0be834 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Lib/project.json.template +++ b/src/dotnet/commands/dotnet-new/CSharp_Lib/project.json.template @@ -7,7 +7,9 @@ }, "frameworks": { "netstandard1.6": { - "NETStandard.Library": "1.5.0-rc3-24126-00" + "dependencies": { + "NETStandard.Library": "1.6.0-rc3-24210-06" + } } } } diff --git a/src/dotnet/commands/dotnet-new/README.md b/src/dotnet/commands/dotnet-new/README.md index 8968d1f9a..368ac7b39 100644 --- a/src/dotnet/commands/dotnet-new/README.md +++ b/src/dotnet/commands/dotnet-new/README.md @@ -29,7 +29,16 @@ Language of project. Defaults to `C##`. Also `csharp` ( `fsharp` ) or `cs` ( `fs `-t`, `--type` -Type of the project. Valid values are "console" and "web". +Type of the project. Valid values for C# are: + +* `console` +* `web` +* `lib` +* `xunittest` + +Valid values for F# are: + +* `console` ## EXAMPLES diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSLIbrary.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSLIbrary.cs new file mode 100644 index 000000000..d580ea0ca --- /dev/null +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSLIbrary.cs @@ -0,0 +1,58 @@ +// 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 +{ + public class GivenThatIWantANewCSLibrary : TestBase + { + + [Fact] + public void When_library_created_Then_project_restores() + { + var rootPath = Temp.CreateDirectory().Path; + var projectJsonFile = Path.Combine(rootPath, "project.json"); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("new --type lib") + .Should() + .Pass(); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("restore") + .Should().Pass(); + + } + + [Fact] + public void When_dotnet_build_is_invoked_Then_project_builds_without_warnings() + { + var rootPath = Temp.CreateDirectory().Path; + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("new --type lib"); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("restore"); + + var buildResult = new TestCommand("dotnet") + .WithWorkingDirectory(rootPath) + .ExecuteWithCapturedOutput("build") + .Should() + .Pass() + .And + .NotHaveStdErr(); + } + + + } +} diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs new file mode 100644 index 000000000..777e03eea --- /dev/null +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs @@ -0,0 +1,58 @@ +// 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 +{ + public class GivenThatIWantANewCSxUnitProject : TestBase + { + + [Fact] + 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") + .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 xunittest"); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("restore"); + + var buildResult = new TestCommand("dotnet") + .WithWorkingDirectory(rootPath) + .ExecuteWithCapturedOutput("test") + .Should() + .Pass() + .And + .NotHaveStdErr(); + } + + + } +}