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";
|
2016-10-31 23:16:07 +00:00
|
|
|
var testInstance = TestAssets.Get(testAppName)
|
|
|
|
.CreateInstance(testAppName)
|
|
|
|
.WithSourceFiles()
|
|
|
|
.WithRestoreFiles();
|
2016-09-27 21:41:06 +00:00
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
new BuildCommand()
|
2016-10-31 23:16:07 +00:00
|
|
|
.WithWorkingDirectory(testInstance.Root)
|
2016-07-21 23:29:35 +00:00
|
|
|
.Execute()
|
2016-10-31 23:16:07 +00:00
|
|
|
.Should().Pass();
|
2016-06-17 23:16:09 +00:00
|
|
|
|
|
|
|
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
|
2016-10-31 23:16:07 +00:00
|
|
|
|
|
|
|
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.0")
|
|
|
|
.GetFile($"{testAppName}.dll");
|
|
|
|
|
2016-06-17 23:16:09 +00:00
|
|
|
var outputRunCommand = new TestCommand("dotnet");
|
|
|
|
|
2016-10-31 23:16:07 +00:00
|
|
|
outputRunCommand.ExecuteWithCapturedOutput(outputDll.FullName)
|
|
|
|
.Should().Pass()
|
|
|
|
.And.HaveStdOutContaining("Hello World");
|
2016-06-17 23:16:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|