3a9525b5ac
* rel/1.0.1: (66 commits) Update LZMA license with correct text Bump to 2.0.0-rc5-61427-04 Remove duplicate installer suffix Add license text to LZMA SDK license notice Updating the SDK to 1.0.0-alpha-20170224-6 Updating both platform abstractions and dependency model to 1.0.3. Bump Roslyn to 2.0.0-rc5-61424-02 Update Stage0 to use the latest build. Update README with new distros. Back porting #5597 into rel/1.0.0 Fixing the exclude pattern used by the Migration to exclude WEB SDK globs. Remove RID from test package creation Disable migrate and publish web app with content because CI does not have NPM Adding an E2E test for pack with content during migration. Fixing a failing test and adding a few more E2E tests around binplace content for migrated projects. Fix debian_config.json on ubuntu16.10 Updating publish, pack and build of content to use None with Never/false/Never in their metadata for excluded items. Intermediate commit to get a WIP PR out. This adds the None Update with CopyToOutputDirectory set to Never. Switching the CopyToOutput for build and publish and the file for pack to use None Update instead of include. Also, fixed the exclude patterns for web apps. Do not migrate Content that is already included in the Web SDK for web apps. ...
102 lines
3.3 KiB
C#
102 lines
3.3 KiB
C#
// 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.IO;
|
|
using FluentAssertions;
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
using Xunit;
|
|
using System.Linq;
|
|
|
|
namespace Microsoft.DotNet.Cli.Build.Tests
|
|
{
|
|
public class GivenDotnetBuildBuildsCsproj : TestBase
|
|
{
|
|
[Fact]
|
|
public void ItBuildsARunnableOutput()
|
|
{
|
|
var testAppName = "MSBuildTestApp";
|
|
var testInstance = TestAssets.Get(testAppName)
|
|
.CreateInstance(testAppName)
|
|
.WithSourceFiles()
|
|
.WithRestoreFiles();
|
|
|
|
new BuildCommand()
|
|
.WithWorkingDirectory(testInstance.Root)
|
|
.Execute()
|
|
.Should().Pass();
|
|
|
|
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
|
|
|
|
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.1")
|
|
.GetFile($"{testAppName}.dll");
|
|
|
|
var outputRunCommand = new TestCommand("dotnet");
|
|
|
|
outputRunCommand.ExecuteWithCapturedOutput(outputDll.FullName)
|
|
.Should().Pass()
|
|
.And.HaveStdOutContaining("Hello World");
|
|
}
|
|
|
|
[Fact]
|
|
public void ItRunsWhenRestoringToSpecificPackageDir()
|
|
{
|
|
var rootPath = TestAssets.CreateTestDirectory().FullName;
|
|
|
|
string dir = "pkgs";
|
|
string args = $"--packages {dir}";
|
|
|
|
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\" --debug:ephemeral-hive";
|
|
new NewCommandShim()
|
|
.WithWorkingDirectory(rootPath)
|
|
.Execute(newArgs)
|
|
.Should()
|
|
.Pass();
|
|
|
|
new RestoreCommand()
|
|
.WithWorkingDirectory(rootPath)
|
|
.Execute(args)
|
|
.Should()
|
|
.Pass()
|
|
.And.NotHaveStdErr();
|
|
|
|
new BuildCommand()
|
|
.WithWorkingDirectory(rootPath)
|
|
.Execute()
|
|
.Should().Pass();
|
|
|
|
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
|
|
|
|
var outputDll = Directory.EnumerateFiles(
|
|
Path.Combine(rootPath, "bin", configuration, "netcoreapp1.1"), "*.dll",
|
|
SearchOption.TopDirectoryOnly)
|
|
.Single();
|
|
|
|
var outputRunCommand = new TestCommand("dotnet");
|
|
|
|
outputRunCommand.ExecuteWithCapturedOutput(outputDll)
|
|
.Should().Pass()
|
|
.And.HaveStdOutContaining("Hello World");
|
|
}
|
|
|
|
[Fact]
|
|
public void ItPrintsBuildSummary()
|
|
{
|
|
var testAppName = "MSBuildTestApp";
|
|
var testInstance = TestAssets.Get(testAppName)
|
|
.CreateInstance(testAppName)
|
|
.WithSourceFiles()
|
|
.WithRestoreFiles();
|
|
|
|
string expectedBuildSummary = @"Build succeeded.
|
|
0 Warning(s)
|
|
0 Error(s)";
|
|
|
|
var cmd = new BuildCommand()
|
|
.WithWorkingDirectory(testInstance.Root)
|
|
.ExecuteWithCapturedOutput();
|
|
cmd.Should().Pass();
|
|
cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary);
|
|
}
|
|
}
|
|
}
|