dotnet-installer/test/EndToEnd/GivenDotNetUsesMSBuild.cs
Eric Erhardt 33ec55aee3 Fix dotnet run3 --project to pass the project to msbuild.
Also update Microsoft.NET.Sdk to 1.0.0-alpha-20161026-2 since this has the corresponding fix needed for https://github.com/dotnet/sdk/issues/301.
2016-10-26 00:04:40 -05:00

121 lines
3.9 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 Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace Microsoft.DotNet.Tests.EndToEnd
{
public class GivenDotNetUsesMSBuild : TestBase
{
public static void Main()
{
}
[Fact]
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
{
using (DisposableDirectory directory = Temp.CreateDirectory())
{
string projectDirectory = directory.Path;
new NewCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("")
.Should()
.Pass();
new Restore3Command()
.WithWorkingDirectory(projectDirectory)
.Execute("/p:SkipInvalidConfigurations=true")
.Should()
.Pass();
new Build3Command()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
new Run3Command()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
var binDirectory = new DirectoryInfo(projectDirectory).Sub("bin");
binDirectory.Should().HaveFilesMatching("*.dll", SearchOption.AllDirectories);
new Clean3Command()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
}
}
[Fact]
public void ItCanRunToolsInACSProj()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
var testProjectDirectory = testInstance.TestRoot;
new Restore3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
new DotnetCommand()
.WithWorkingDirectory(testInstance.TestRoot)
.ExecuteWithCapturedOutput("portable")
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello Portable World!");;
}
[Fact]
public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
{
var repoDirectoriesProvider = new RepoDirectoriesProvider();
var testAppName = "MSBuildTestAppWithToolInDependencies";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
var configuration = "Debug";
var testProjectDirectory = testInstance.TestRoot;
new Restore3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute($"-s {repoDirectoriesProvider.TestPackages}")
.Should()
.Pass();
new Build3Command()
.WithWorkingDirectory(testProjectDirectory)
.Execute($"-c {configuration}")
.Should()
.Pass();
new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput(
$"-v dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello Portable World!");;
}
}
}