Merge pull request #1673 from livarcocc/dotnet_test_framework

Use projectcontext.TargetFramwork for dotnet test design time
This commit is contained in:
Livar 2016-03-02 23:34:46 -08:00
commit 78dbbfc83d
4 changed files with 12 additions and 4 deletions

View file

@ -8,11 +8,13 @@ namespace Microsoft.DotNet.Cli.Utils
{
public class FixedPathCommandFactory : ICommandFactory
{
private readonly NuGetFramework _nugetFramework;
private readonly string _configuration;
private readonly string _outputPath;
public FixedPathCommandFactory(string configuration, string outputPath)
public FixedPathCommandFactory(NuGetFramework nugetFramework, string configuration, string outputPath)
{
_nugetFramework = nugetFramework;
_configuration = configuration;
_outputPath = outputPath;
}
@ -28,6 +30,11 @@ namespace Microsoft.DotNet.Cli.Utils
configuration = _configuration;
}
if (framework == null)
{
framework = _nugetFramework;
}
return Command.Create(commandName, args, framework, configuration, _outputPath);
}
}

View file

@ -159,7 +159,8 @@ namespace Microsoft.DotNet.Tools.Test
var messages = new TestMessagesCollection();
using (var dotnetTest = new DotnetTest(messages, assemblyUnderTest))
{
var commandFactory = new FixedPathCommandFactory(configuration, outputPath);
var commandFactory =
new FixedPathCommandFactory(projectContext.TargetFramework, configuration, outputPath);
var testRunnerFactory = new TestRunnerFactory(GetCommandName(testRunner), commandFactory);
dotnetTest

View file

@ -53,7 +53,7 @@ namespace Microsoft.DotNet.Tools.Test
return _commandFactory.Create(
$"dotnet-{_testRunner}",
commandArgs,
new NuGetFramework("DNXCore", Version.Parse("5.0")),
null,
null);
}
}

View file

@ -40,7 +40,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
_commandFactoryMock.Setup(c => c.Create(
$"dotnet-{_runner}",
_testRunnerArguments,
new NuGetFramework("DNXCore", Version.Parse("5.0")),
null,
null)).Returns(_commandMock.Object).Verifiable();
}