dotnet-installer/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs
Piotr Puszkiewicz 6fcbefa4f7 [WIP] Removes *3 verbs, making msbuild the driver (#4456)
Removes *3 verbs, making msbuild the driver
2016-10-27 18:46:43 -07:00

46 lines
1.5 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;
namespace Microsoft.DotNet.Cli.Build.Tests
{
public class GivenDotnetBuildBuildsCsproj : TestBase
{
[Fact]
public void It_builds_a_runnable_output()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
var testProjectDirectory = testInstance.TestRoot;
new RestoreCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute("/p:SkipInvalidConfigurations=true")
.Should()
.Pass();
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.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");
}
}
}