From 89cf169a08ff82328f02b4ec0423891ef944920d Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 23 Feb 2016 11:09:43 -0800 Subject: [PATCH] Fix run tests --- .../RunTestsApps/TestAppFullClr/Program.cs | 2 +- .../TestAppMultiTargetNoCoreClr/project.json | 4 ++-- scripts/dotnet-cli-build/TestTargets.cs | 1 + test/dotnet-run.Tests/RunTests.cs | 19 +++++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/TestAssets/TestProjects/RunTestsApps/TestAppFullClr/Program.cs b/TestAssets/TestProjects/RunTestsApps/TestAppFullClr/Program.cs index 6c7b146ea..1d00917a4 100644 --- a/TestAssets/TestProjects/RunTestsApps/TestAppFullClr/Program.cs +++ b/TestAssets/TestProjects/RunTestsApps/TestAppFullClr/Program.cs @@ -6,7 +6,7 @@ namespace ConsoleApplication { public static void Main(string[] args) { - .WriteLine("NET451"); + Console.WriteLine("NET451"); } } } diff --git a/TestAssets/TestProjects/RunTestsApps/TestAppMultiTargetNoCoreClr/project.json b/TestAssets/TestProjects/RunTestsApps/TestAppMultiTargetNoCoreClr/project.json index 470e49702..2e7a025eb 100644 --- a/TestAssets/TestProjects/RunTestsApps/TestAppMultiTargetNoCoreClr/project.json +++ b/TestAssets/TestProjects/RunTestsApps/TestAppMultiTargetNoCoreClr/project.json @@ -5,7 +5,7 @@ }, "frameworks": { - "dummy1": { }, - "net451": { } + "net451": { }, + "net45": { } } } diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index 9329b2cae..3ceea87e6 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -29,6 +29,7 @@ namespace Microsoft.DotNet.Cli.Build "dotnet-build.Tests", "dotnet-pack.Tests", "dotnet-resgen.Tests", + "dotnet-run.Tests", "Microsoft.DotNet.Cli.Utils.Tests", "Microsoft.DotNet.Compiler.Common.Tests", "Microsoft.DotNet.ProjectModel.Tests", diff --git a/test/dotnet-run.Tests/RunTests.cs b/test/dotnet-run.Tests/RunTests.cs index 5b82db95c..eaadc4c09 100644 --- a/test/dotnet-run.Tests/RunTests.cs +++ b/test/dotnet-run.Tests/RunTests.cs @@ -3,38 +3,41 @@ using System; using System.IO; +using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; -namespace Microsoft.DotNet.Tools.Compiler.Tests +namespace Microsoft.DotNet.Tools.Run.Tests { - public class CompilerTests : TestBase + public class RunTests : TestBase { - private static const string RunTestsBase = "RunTestsApps"; + private const string RunTestsBase = "RunTestsApps"; [WindowsOnlyFact] public void RunsSingleTarget() { - TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(RunTestsBase, "TestAppDesktopClr")) + TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(RunTestsBase, "TestAppFullClr")) .WithLockFiles() .WithBuildArtifacts(); - new RunCommand(testInstance.TestRoot).Execute().Should().Pass(); + new RunCommand(instance.TestRoot).Execute().Should().Pass(); } + [Fact] public void RunsDefaultWhenPresent() { TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(RunTestsBase, "TestAppMultiTarget")) .WithLockFiles() .WithBuildArtifacts(); - new RunCommand(testInstance.TestRoot).Execute().Should().Pass(); + new RunCommand(instance.TestRoot).Execute().Should().Pass(); } + [Fact] public void FailsWithMultipleTargetAndNoDefault() { - TestInstance instance = TestAssetsManager.CreateTestInstance(RunTestsBase, "TestAppMultiTargetNoCoreClr") + TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(RunTestsBase, "TestAppMultiTargetNoCoreClr")) .WithLockFiles() .WithBuildArtifacts(); - new RunCommand(testInstance.TestRoot).Execute().Should().Fail(); + new RunCommand(instance.TestRoot).Execute().Should().Fail(); } private void CopyProjectToTempDir(string projectDir, TempDirectory tempDir)