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".
This commit is contained in:
Eric Erhardt 2016-04-07 21:54:59 -05:00
parent 4c704997c9
commit 8a9068efbf
3 changed files with 8 additions and 5 deletions

View file

@ -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
/// <returns></returns>
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

View file

@ -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",

View file

@ -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"
},