2016-06-11 13:43:56 +00:00
|
|
|
// 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()
|
|
|
|
{
|
2016-10-14 07:06:35 +00:00
|
|
|
var rootPath = TestAssetsManager.CreateTestDirectory().Path;
|
2016-06-11 13:43:56 +00:00
|
|
|
|
|
|
|
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
|
|
|
.Execute("new --type lib")
|
2016-10-14 07:06:35 +00:00
|
|
|
.Should().Pass();
|
2016-06-11 13:43:56 +00:00
|
|
|
|
|
|
|
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
2016-10-14 07:06:35 +00:00
|
|
|
.Execute("restore3 /p:SkipInvalidConfigurations=true")
|
2016-06-11 13:43:56 +00:00
|
|
|
.Should().Pass();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
2016-10-14 07:06:35 +00:00
|
|
|
public void When_dotnet_build_is_invoked_Then_library_builds_without_warnings()
|
2016-06-11 13:43:56 +00:00
|
|
|
{
|
2016-10-14 07:06:35 +00:00
|
|
|
var rootPath = TestAssetsManager.CreateTestDirectory().Path;
|
2016-06-11 13:43:56 +00:00
|
|
|
|
|
|
|
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
|
|
|
.Execute("new --type lib");
|
|
|
|
|
|
|
|
new TestCommand("dotnet") { WorkingDirectory = rootPath }
|
2016-10-14 07:06:35 +00:00
|
|
|
.Execute("restore3 /p:SkipInvalidConfigurations=true");
|
2016-06-11 13:43:56 +00:00
|
|
|
|
|
|
|
var buildResult = new TestCommand("dotnet")
|
|
|
|
.WithWorkingDirectory(rootPath)
|
2016-10-14 07:06:35 +00:00
|
|
|
.ExecuteWithCapturedOutput("build3")
|
|
|
|
.Should().Pass()
|
|
|
|
.And.NotHaveStdErr();
|
2016-06-11 13:43:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|