[WIP] Removes *3 verbs, making msbuild the driver (#4456)

Removes *3 verbs, making msbuild the driver
This commit is contained in:
Piotr Puszkiewicz 2016-10-27 18:46:43 -07:00 committed by GitHub
parent 55c59d621e
commit 6fcbefa4f7
746 changed files with 4256 additions and 32434 deletions

View file

@ -31,63 +31,29 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{
var configuration = "Debug";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
.WithLockFiles();
var buildCommand = new BuildCommand(
Path.Combine(testInstance.TestRoot, "project.json"),
configuration: configuration)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var context = ProjectContext.Create(testInstance.TestRoot, s_desktopTestFramework);
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "AppWithProjTool2Fx")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var buildCommand = new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.WithConfiguration(configuration)
.WithCapturedOutput()
.Execute()
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
s_desktopTestFramework,
null,
null,
null,
testInstance.TestRoot);
testInstance.Root.FullName);
var command = factory.Create("dotnet-desktop-and-portable", null);
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
}
command.CommandName.Should().Contain(testInstance.Root.GetDirectory("bin", configuration).FullName);
[WindowsOnlyFact]
public void It_resolves_desktop_apps_with_MSBuild_defaulting_to_Debug_Configuration()
{
var configuration = "Debug";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "TestProjects"));
var testInstance = testAssetManager.CreateTestInstance("MSBuildAppWithMultipleFrameworksAndTools", "i")
.WithLockFiles();
var projectFile = Path.Combine(testInstance.TestRoot, "MSBuildAppWithMultipleFrameworksAndTools.csproj");
new Restore3Command()
.ExecuteWithCapturedOutput($"{projectFile} -s {_repoDirectoriesProvider.TestPackages}")
.Should()
.Pass();
new Build3Command()
.Execute($"{projectFile} --configuration {configuration}")
.Should()
.Pass();
var factory = new ProjectDependenciesCommandFactory(
s_desktopTestFramework,
null,
null,
null,
testInstance.TestRoot);
var command = factory.Create("dotnet-desktop-and-portable", null);
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
}
@ -96,29 +62,27 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{
var configuration = "Debug";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
.WithLockFiles();
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "AppWithProjTool2Fx")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var buildCommand = new BuildCommand(
Path.Combine(testInstance.TestRoot, "project.json"),
configuration: configuration)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var context = ProjectContext.Create(testInstance.TestRoot, s_desktopTestFramework);
var buildCommand = new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.WithConfiguration(configuration)
.Execute()
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
s_desktopTestFramework,
configuration,
null,
null,
testInstance.TestRoot);
testInstance.Root.FullName);
var command = factory.Create("dotnet-desktop-and-portable", null);
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
command.CommandName.Should().Contain(testInstance.Root.GetDirectory("bin", configuration).FullName);
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
}
@ -127,29 +91,29 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{
var configuration = "Release";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
.WithLockFiles();
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "AppWithProjTool2Fx")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var buildCommand = new BuildCommand(
Path.Combine(testInstance.TestRoot, "project.json"),
configuration: configuration)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var context = ProjectContext.Create(testInstance.TestRoot, s_desktopTestFramework);
var buildCommand = new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.WithConfiguration(configuration)
.WithCapturedOutput()
.Execute()
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
s_desktopTestFramework,
configuration,
null,
null,
testInstance.TestRoot);
testInstance.Root.FullName);
var command = factory.Create("dotnet-desktop-and-portable", null);
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
command.CommandName.Should().Contain(testInstance.Root.GetDirectory("bin", configuration).FullName);
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
}
@ -158,56 +122,59 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{
var configuration = "Release";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
.WithLockFiles();
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "AppWithProjTool2Fx")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var buildCommand = new BuildCommand(
Path.Combine(testInstance.TestRoot, "project.json"),
configuration: configuration)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var context = ProjectContext.Create(testInstance.TestRoot, s_desktopTestFramework);
var buildCommand = new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.WithConfiguration(configuration)
.WithCapturedOutput()
.Execute()
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
s_desktopTestFramework,
"Debug",
null,
null,
testInstance.TestRoot);
testInstance.Root.FullName);
var command = factory.Create("dotnet-desktop-and-portable", null, configuration: configuration);
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
command.CommandName.Should().Contain(testInstance.Root.GetDirectory("bin", configuration).FullName);
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
}
[Fact]
public void It_resolves_tools_whose_package_name_is_different_than_dll_name()
{
Environment.SetEnvironmentVariable(
Constants.MSBUILD_EXE_PATH,
Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, "MSBuild.dll"));
var configuration = "Debug";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "TestProjects"));
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepWithOutputName")
.WithLockFiles();
var testInstance = TestAssets.Get("AppWithDirectDepWithOutputName")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var buildCommand = new BuildCommand(
Path.Combine(testInstance.TestRoot, "project.json"),
configuration: configuration)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var context = ProjectContext.Create(testInstance.TestRoot, FrameworkConstants.CommonFrameworks.NetCoreApp10);
var buildCommand = new BuildCommand()
.WithProjectDirectory(testInstance.Root)
.WithConfiguration(configuration)
.WithCapturedOutput()
.Execute()
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
FrameworkConstants.CommonFrameworks.NetCoreApp10,
configuration,
null,
null,
testInstance.TestRoot);
testInstance.Root.FullName);
var command = factory.Create("dotnet-tool-with-output-name", null);