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.
// 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;
@ -91,6 +92,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
var testAppName = "MSBuildTestAppWithToolInDependencies";
var testInstance = TestAssetsManager
.CreateTestInstance(testAppName);
var configuration = Environment.GetEnvironmentVariable("Configuration") ?? "Debug";
var testProjectDirectory = testInstance.TestRoot;
@ -108,7 +110,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd
new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("-v dependency-tool-invoker -f netcoreapp1.0 portable")
.ExecuteWithCapturedOutput(
$"-v dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
.Should()
.Pass()
.And

View file

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