diff --git a/TestAssets/TestProjects/ProjectWithTests/GivenThatIWantSomeFakeTests.cs b/TestAssets/ProjectWithTests/GivenThatIWantSomeFakeTests.cs similarity index 100% rename from TestAssets/TestProjects/ProjectWithTests/GivenThatIWantSomeFakeTests.cs rename to TestAssets/ProjectWithTests/GivenThatIWantSomeFakeTests.cs diff --git a/TestAssets/TestProjects/ProjectWithTests/project.json b/TestAssets/ProjectWithTests/project.json similarity index 62% rename from TestAssets/TestProjects/ProjectWithTests/project.json rename to TestAssets/ProjectWithTests/project.json index eba1ae115..ffe054cb0 100644 --- a/TestAssets/TestProjects/ProjectWithTests/project.json +++ b/TestAssets/ProjectWithTests/project.json @@ -1,15 +1,19 @@ { "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24008", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0-rc2-*" + }, "System.Linq.Expressions": "4.0.11-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "xunit": "2.1.0", - "dotnet-test-xunit": "1.0.0-dev-128011-22" + "dotnet-test-xunit": "1.0.0-dev-140469-38" }, "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "imports": [ + "netstandardapp1.5", "dnxcore50", "portable-net45+win8" ] diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index 5e394ba1d..9df8b95a0 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -93,7 +93,17 @@ namespace Microsoft.DotNet.Cli.Build "--fallbacksource", Dirs.TestPackages, "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects")) - .Execute().EnsureSuccessful(); + .Execute() + .EnsureSuccessful(); + + // The 'ProjectWithTests' is a portable test app. Cannot call --infer-runtimes on it, since on win x64 machines, + // the x86 runtime is being inferred, and there are no x86 DotNetHost packages + dotnet.Restore( + "--verbosity", "verbose", + "--fallbacksource", Dirs.Corehost) + .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectWithTests")) + .Execute() + .EnsureSuccessful(); // The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output dotnet.Restore( @@ -248,6 +258,14 @@ namespace Microsoft.DotNet.Cli.Build .EnsureSuccessful(); } + // build ProjectWithTests, which is outside of TestProjects and targets netcoreapp + string projectWithTests = Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectWithTests"); + c.Info($"Building: {projectWithTests}"); + dotnet.Build("--framework", "netcoreapp1.0") + .WorkingDirectory(projectWithTests) + .Execute() + .EnsureSuccessful(); + return c.Success(); } diff --git a/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs b/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs index c196e8b45..e431ca7ee 100644 --- a/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs +++ b/test/dotnet-test.Tests/GivenThatWeWantToRunTestsInTheConsole.cs @@ -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(); } diff --git a/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs b/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs index 570e9d316..a3e4fd1af 100644 --- a/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs +++ b/test/dotnet-test.Tests/GivenThatWeWantToUseDotnetTestE2EInDesignTime.cs @@ -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();