dotnet-installer/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs

91 lines
2.9 KiB
C#
Raw Normal View History

2016-09-23 19:49:24 +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 Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace Microsoft.DotNet.Cli.Run3.Tests
{
public class GivenDotnetRun3BuildsCsproj : TestBase
{
[Fact]
public void ItCanRunAMSBuildProject()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
2016-09-23 19:49:24 +00:00
var testProjectDirectory = testInstance.TestRoot;
new Restore3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
2016-09-23 19:49:24 +00:00
new Build3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
2016-09-27 23:29:56 +00:00
//TODO: https://github.com/dotnet/sdk/issues/187 - remove framework from below.
2016-09-23 19:49:24 +00:00
new Run3Command()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp1.0")
2016-09-23 19:49:24 +00:00
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItBuildsTheProjectBeforeRunning()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
2016-09-23 19:49:24 +00:00
var testProjectDirectory = testInstance.TestRoot;
new Restore3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
2016-09-27 23:29:56 +00:00
//TODO: https://github.com/dotnet/sdk/issues/187 - remove framework from below.
2016-09-23 19:49:24 +00:00
new Run3Command()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp1.0")
2016-09-23 19:49:24 +00:00
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItCanRunAMSBuildProjectWhenSpecifyingAFramework()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
2016-09-23 19:49:24 +00:00
var testProjectDirectory = testInstance.TestRoot;
new Restore3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
2016-09-23 19:49:24 +00:00
new Run3Command()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp1.0")
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
}
}
}