Making the tests aware of the Configuration used in the build.

This commit is contained in:
Livar Cunha 2016-10-14 10:23:50 -07:00
parent 99d6b1fd6d
commit 58bc3b5853
2 changed files with 11 additions and 5 deletions

View file

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. // 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. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO; using System.IO;
using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit; using Xunit;
@ -91,6 +92,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
var testAppName = "MSBuildTestAppWithToolInDependencies"; var testAppName = "MSBuildTestAppWithToolInDependencies";
var testInstance = TestAssetsManager var testInstance = TestAssetsManager
.CreateTestInstance(testAppName); .CreateTestInstance(testAppName);
var configuration = Environment.GetEnvironmentVariable("Configuration") ?? "Debug";
var testProjectDirectory = testInstance.TestRoot; var testProjectDirectory = testInstance.TestRoot;
@ -108,7 +110,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd
new DotnetCommand() new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("-v dependency-tool-invoker -f netcoreapp1.0 portable") .ExecuteWithCapturedOutput(
$"-v dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
.Should() .Should()
.Pass() .Pass()
.And .And

View file

@ -19,6 +19,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{ {
private TestInstance MSBuildTestProjectInstance; private TestInstance MSBuildTestProjectInstance;
private RepoDirectoriesProvider _repoDirectoriesProvider; private RepoDirectoriesProvider _repoDirectoriesProvider;
private string _configuration;
public GivenAProjectDependencyCommandResolverBeingUsedWithMSBuild() public GivenAProjectDependencyCommandResolverBeingUsedWithMSBuild()
{ {
@ -38,6 +39,8 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
.Should() .Should()
.Pass(); .Pass();
_configuration = Environment.GetEnvironmentVariable("Configuration") ?? "Debug";
Environment.SetEnvironmentVariable( Environment.SetEnvironmentVariable(
Constants.MSBUILD_EXE_PATH, Constants.MSBUILD_EXE_PATH,
Path.Combine(_repoDirectoriesProvider.Stage2Sdk, "msbuild.exe")); Path.Combine(_repoDirectoriesProvider.Stage2Sdk, "msbuild.exe"));
@ -54,7 +57,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable", CommandName = "dotnet-portable",
CommandArguments = null, CommandArguments = null,
ProjectDirectory = MSBuildTestProjectInstance.Path, ProjectDirectory = MSBuildTestProjectInstance.Path,
Configuration = "Debug", Configuration = _configuration,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
}; };
@ -79,7 +82,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable", CommandName = "dotnet-portable",
CommandArguments = null, CommandArguments = null,
ProjectDirectory = MSBuildTestProjectInstance.Path, ProjectDirectory = MSBuildTestProjectInstance.Path,
Configuration = "Debug", Configuration = _configuration,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
}; };
@ -99,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "nonexistent-command", CommandName = "nonexistent-command",
CommandArguments = null, CommandArguments = null,
ProjectDirectory = MSBuildTestProjectInstance.Path, ProjectDirectory = MSBuildTestProjectInstance.Path,
Configuration = "Debug", Configuration = _configuration,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
}; };
@ -122,7 +125,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable", CommandName = "dotnet-portable",
CommandArguments = null, CommandArguments = null,
ProjectDirectory = testInstance.Path, ProjectDirectory = testInstance.Path,
Configuration = "Debug", Configuration = _configuration,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10, Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
OutputPath = outputDir OutputPath = outputDir
}; };