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:
parent
8a9068efbf
commit
7d6d74bba2
5 changed files with 36 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Xunit;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
@ -18,8 +19,9 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
|||
|
||||
public GivenThatWeWantToRunTestsInTheConsole()
|
||||
{
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
|
||||
var testInstance =
|
||||
TestAssetsManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests").WithLockFiles();
|
||||
testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests").WithLockFiles();
|
||||
|
||||
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
|
||||
var contexts = ProjectContext.CreateContextForEachFramework(
|
||||
|
@ -27,8 +29,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
|||
null,
|
||||
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
|
||||
|
||||
var runtime = contexts.FirstOrDefault(c => !string.IsNullOrEmpty(c.RuntimeIdentifier))?.RuntimeIdentifier;
|
||||
_defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, runtime);
|
||||
_defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
|
||||
}
|
||||
|
||||
//ISSUE https://github.com/dotnet/cli/issues/1935
|
||||
|
@ -55,7 +56,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
|||
{
|
||||
var testCommand = new DotnetTestCommand();
|
||||
var result = testCommand.Execute(
|
||||
$"{_projectFilePath} -o {Path.Combine(AppContext.BaseDirectory, "output")} -f netstandardapp1.5");
|
||||
$"{_projectFilePath} -o {Path.Combine(AppContext.BaseDirectory, "output")} -f netcoreapp1.0");
|
||||
result.Should().Pass();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue