From 8a9068efbff66f85997c88a239c091779d61cea1 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 7 Apr 2016 21:54:59 -0500 Subject: [PATCH] Fixing tests now they are portable. 2 tests needed to lift System.Diagnostics.TraceSource since it isn't in the shared framework. The ArgumentReflector is now a portable app, so it needs to be invoked with "dotnet". --- .../ArgumentForwardingTests.cs | 11 ++++++----- test/Microsoft.DotNet.Cli.Utils.Tests/project.json | 1 + .../project.json | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/ArgumentForwardingTests/ArgumentForwardingTests.cs b/test/ArgumentForwardingTests/ArgumentForwardingTests.cs index 8834625af..95be0edaa 100644 --- a/test/ArgumentForwardingTests/ArgumentForwardingTests.cs +++ b/test/ArgumentForwardingTests/ArgumentForwardingTests.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Text; using Xunit; @@ -18,7 +19,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding { public class ArgumentForwardingTests : TestBase { - private static readonly string s_reflectorExeName = "ArgumentsReflector" + Constants.ExeSuffix; + private static readonly string s_reflectorDllName = "ArgumentsReflector.dll"; private static readonly string s_reflectorCmdName = "reflector_cmd"; private string ReflectorPath { get; set; } @@ -38,7 +39,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding private void FindAndEnsureReflectorPresent() { - ReflectorPath = Path.Combine(AppContext.BaseDirectory, s_reflectorExeName); + ReflectorPath = Path.Combine(AppContext.BaseDirectory, s_reflectorDllName); ReflectorCmdPath = Path.Combine(AppContext.BaseDirectory, s_reflectorCmdName); File.Exists(ReflectorPath).Should().BeTrue(); } @@ -182,7 +183,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding /// private string[] EscapeAndEvaluateArgumentString(string[] rawEvaluatedArgument) { - var commandResult = Command.Create(ReflectorPath, rawEvaluatedArgument) + var commandResult = Command.Create("dotnet", new[] { ReflectorPath }.Concat(rawEvaluatedArgument)) .CaptureStdErr() .CaptureStdOut() .Execute(); @@ -262,8 +263,8 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding { StartInfo = new ProcessStartInfo { - FileName = ReflectorPath, - Arguments = testUserArgument, + FileName = Env.GetCommandPath("dotnet", ".exe", ""), + Arguments = $"{ReflectorPath} {testUserArgument}", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index 6eacbd4e1..2f693bd56 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -8,6 +8,7 @@ "type": "platform", "version": "1.0.0-rc2-*" }, + "System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1130", diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index 1ead922b7..f936e4f0f 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -9,6 +9,7 @@ "type": "platform", "version": "1.0.0-rc2-*" }, + "System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },