Merge pull request #1609 from livarcocc/dotnet_test_xunit_command
Dotnet test creating the command using dotnet-test-xunit
This commit is contained in:
commit
208a0f31ec
6 changed files with 34 additions and 7 deletions
20
src/Microsoft.DotNet.Cli.Utils/CommandFactory.cs
Normal file
20
src/Microsoft.DotNet.Cli.Utils/CommandFactory.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// 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 NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
public class CommandFactory : ICommandFactory
|
||||
{
|
||||
public ICommand Create(
|
||||
string commandName,
|
||||
IEnumerable<string> args,
|
||||
NuGetFramework framework = null,
|
||||
string configuration = Constants.DefaultConfiguration)
|
||||
{
|
||||
return Command.Create(commandName, args, framework, configuration);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,9 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
public interface ICommandFactory
|
||||
{
|
||||
ICommand Create(
|
||||
string commandName, IEnumerable<string> args, NuGetFramework framework = null, string configuration = null);
|
||||
string commandName,
|
||||
IEnumerable<string> args,
|
||||
NuGetFramework framework = null,
|
||||
string configuration = Constants.DefaultConfiguration);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
var messages = new TestMessagesCollection();
|
||||
using (var dotnetTest = new DotnetTest(messages, assemblyUnderTest))
|
||||
{
|
||||
var commandFactory = new DotNetCommandFactory();
|
||||
var commandFactory = new CommandFactory();
|
||||
var testRunnerFactory = new TestRunnerFactory(GetCommandName(testRunner), commandFactory);
|
||||
|
||||
dotnetTest
|
||||
|
|
|
@ -140,7 +140,10 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
Socket.Dispose();
|
||||
if (Socket != null)
|
||||
{
|
||||
Socket.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,9 +51,10 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
var commandArgs = _argumentsBuilder.BuildArguments();
|
||||
|
||||
return _commandFactory.Create(
|
||||
_testRunner,
|
||||
$"dotnet-{_testRunner}",
|
||||
commandArgs,
|
||||
new NuGetFramework("DNXCore", Version.Parse("5.0")));
|
||||
new NuGetFramework("DNXCore", Version.Parse("5.0")),
|
||||
Constants.DefaultConfiguration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
|||
|
||||
_commandFactoryMock = new Mock<ICommandFactory>();
|
||||
_commandFactoryMock.Setup(c => c.Create(
|
||||
_runner,
|
||||
$"dotnet-{_runner}",
|
||||
_testRunnerArguments,
|
||||
new NuGetFramework("DNXCore", Version.Parse("5.0")),
|
||||
null)).Returns(_commandMock.Object).Verifiable();
|
||||
Constants.DefaultConfiguration)).Returns(_commandMock.Object).Verifiable();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Add table
Reference in a new issue