2016-06-17 23:16:09 +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.IO;
|
|
|
|
using FluentAssertions;
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
|
|
using Xunit;
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
namespace Microsoft.DotNet.Cli.Build.Tests
|
2016-06-17 23:16:09 +00:00
|
|
|
{
|
2016-10-28 01:46:43 +00:00
|
|
|
public class GivenDotnetBuildBuildsCsproj : TestBase
|
2016-06-17 23:16:09 +00:00
|
|
|
{
|
|
|
|
[Fact]
|
|
|
|
public void It_builds_a_runnable_output()
|
|
|
|
{
|
|
|
|
var testAppName = "MSBuildTestApp";
|
|
|
|
var testInstance = TestAssetsManager
|
2016-09-27 21:41:06 +00:00
|
|
|
.CreateTestInstance(testAppName);
|
2016-06-17 23:16:09 +00:00
|
|
|
|
|
|
|
var testProjectDirectory = testInstance.TestRoot;
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
new RestoreCommand()
|
2016-09-27 21:41:06 +00:00
|
|
|
.WithWorkingDirectory(testProjectDirectory)
|
2016-10-28 01:46:43 +00:00
|
|
|
.Execute("/p:SkipInvalidConfigurations=true")
|
2016-09-27 21:41:06 +00:00
|
|
|
.Should()
|
|
|
|
.Pass();
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
new BuildCommand()
|
2016-07-21 23:29:35 +00:00
|
|
|
.WithWorkingDirectory(testProjectDirectory)
|
|
|
|
.Execute()
|
2016-06-17 23:16:09 +00:00
|
|
|
.Should()
|
|
|
|
.Pass();
|
|
|
|
|
|
|
|
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
|
|
|
|
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", $"{testAppName}.dll");
|
|
|
|
var outputRunCommand = new TestCommand("dotnet");
|
|
|
|
|
|
|
|
outputRunCommand.ExecuteWithCapturedOutput(outputDll)
|
|
|
|
.Should()
|
|
|
|
.Pass()
|
|
|
|
.And
|
|
|
|
.HaveStdOutContaining("Hello World");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|