Fixing dotnet-test.Tests to use a portable test app - ProjectWithTests.

The ProjectWithTests needed to be moved outside of TestAssets\TestProjects because it can't be restored --infer-runtimes and it has to be built with netcoreapp1.0.
This commit is contained in:
Eric Erhardt 2016-04-07 22:08:17 -05:00
parent 8a9068efbf
commit 7d6d74bba2
5 changed files with 36 additions and 11 deletions

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using System.IO;
using FluentAssertions;
@ -18,15 +19,16 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
public GivenThatWeWantToUseDotnetTestE2EInDesignTime()
{
var testInstance = TestAssetsManager.CreateTestInstance("ProjectWithTests").WithLockFiles();
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests").WithLockFiles();
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework(
_projectFilePath,
null,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
var runtime = contexts.FirstOrDefault(c => !string.IsNullOrEmpty(c.RuntimeIdentifier))?.RuntimeIdentifier;
_outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, runtime);
_outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute();