diff --git a/src/dotnet/commands/dotnet-test/CommandTestRunnerExtensions.cs b/src/dotnet/commands/dotnet-test/CommandTestRunnerExtensions.cs index 3188c167f..d90df7e6a 100644 --- a/src/dotnet/commands/dotnet-test/CommandTestRunnerExtensions.cs +++ b/src/dotnet/commands/dotnet-test/CommandTestRunnerExtensions.cs @@ -1,16 +1,19 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Diagnostics; using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test { public static class CommandTestRunnerExtensions { - public static ProcessStartInfo ToProcessStartInfo(this ICommand command) + public static TestStartInfo ToTestStartInfo(this ICommand command) { - return new ProcessStartInfo(command.CommandName, command.CommandArgs); + return new TestStartInfo + { + FileName = command.CommandName, + Arguments = command.CommandArgs + }; } } } diff --git a/src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs b/src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs index bdac41583..4534c1be2 100644 --- a/src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs +++ b/src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs @@ -1,16 +1,12 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Collections.Generic; -using System.Diagnostics; -using Microsoft.Extensions.Testing.Abstractions; - namespace Microsoft.DotNet.Tools.Test { public interface ITestRunner { void RunTestCommand(); - ProcessStartInfo GetProcessStartInfo(); + TestStartInfo GetProcessStartInfo(); } } diff --git a/src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs b/src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs index b66d39f12..62c898fa6 100644 --- a/src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs +++ b/src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs @@ -29,11 +29,11 @@ namespace Microsoft.DotNet.Tools.Test ExecuteRunnerCommand(); } - public ProcessStartInfo GetProcessStartInfo() + public TestStartInfo GetProcessStartInfo() { var command = CreateTestRunnerCommand(); - return command.ToProcessStartInfo(); + return command.ToTestStartInfo(); } private void ExecuteRunnerCommand() diff --git a/src/dotnet/commands/dotnet-test/TestStartInfo.cs b/src/dotnet/commands/dotnet-test/TestStartInfo.cs new file mode 100644 index 000000000..0a71ea551 --- /dev/null +++ b/src/dotnet/commands/dotnet-test/TestStartInfo.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.DotNet.Tools.Test +{ + public class TestStartInfo + { + public string FileName { get; set; } + + public string Arguments { get; set; } + } +} diff --git a/test/dotnet-test.UnitTests/GivenATestExecutionGetTestRunnerProcessStartInfoMessageHandler.cs b/test/dotnet-test.UnitTests/GivenATestExecutionGetTestRunnerProcessStartInfoMessageHandler.cs index f1e4d1b61..58ae38211 100644 --- a/test/dotnet-test.UnitTests/GivenATestExecutionGetTestRunnerProcessStartInfoMessageHandler.cs +++ b/test/dotnet-test.UnitTests/GivenATestExecutionGetTestRunnerProcessStartInfoMessageHandler.cs @@ -19,7 +19,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests private GetTestRunnerProcessStartInfoMessageHandler _testGetTestRunnerProcessStartInfoMessageHandler; private Message _validMessage; - private ProcessStartInfo _processStartInfo; + private TestStartInfo _testStartInfo; private Mock _testRunnerMock; private Mock _testRunnerFactoryMock; @@ -42,10 +42,14 @@ namespace Microsoft.Dotnet.Tools.Test.Tests _dotnetTestMock.Setup(d => d.State).Returns(DotnetTestState.VersionCheckCompleted); _dotnetTestMock.Setup(d => d.PathToAssemblyUnderTest).Returns(AssemblyUnderTest); - _processStartInfo = new ProcessStartInfo("runner", "arguments"); + _testStartInfo = new TestStartInfo + { + FileName = "runner", + Arguments = "arguments" + }; _testRunnerMock = new Mock(); - _testRunnerMock.Setup(t => t.GetProcessStartInfo()).Returns(_processStartInfo); + _testRunnerMock.Setup(t => t.GetProcessStartInfo()).Returns(_testStartInfo); _testRunnerFactoryMock = new Mock(); _testRunnerFactoryMock @@ -128,8 +132,8 @@ namespace Microsoft.Dotnet.Tools.Test.Tests { _adapterChannelMock.Setup(r => r.Send(It.Is(m => m.MessageType == TestMessageTypes.TestExecutionTestRunnerProcessStartInfo && - m.Payload.ToObject().FileName == _processStartInfo.FileName && - m.Payload.ToObject().Arguments == _processStartInfo.Arguments))).Verifiable(); + m.Payload.ToObject().FileName == _testStartInfo.FileName && + m.Payload.ToObject().Arguments == _testStartInfo.Arguments))).Verifiable(); _testGetTestRunnerProcessStartInfoMessageHandler.HandleMessage( _dotnetTestMock.Object, diff --git a/test/dotnet-test.UnitTests/GivenThatWeWantToRunTests.cs b/test/dotnet-test.UnitTests/GivenThatWeWantToRunTests.cs index 01da29141..7059bc128 100644 --- a/test/dotnet-test.UnitTests/GivenThatWeWantToRunTests.cs +++ b/test/dotnet-test.UnitTests/GivenThatWeWantToRunTests.cs @@ -19,7 +19,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests dotnetTestMessageScenario.TestRunnerMock .Setup(t => t.GetProcessStartInfo()) - .Returns(new ProcessStartInfo()) + .Returns(new TestStartInfo()) .Verifiable(); dotnetTestMessageScenario.AdapterChannelMock