2016-03-08 23:53:21 +00:00
|
|
|
|
// 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 Microsoft.DotNet.Cli.Utils;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Test.Utilities
|
|
|
|
|
{
|
|
|
|
|
public class DotnetTestCommand : TestCommand
|
|
|
|
|
{
|
2016-11-04 05:12:33 +00:00
|
|
|
|
private string _runtime;
|
|
|
|
|
|
2016-03-08 23:53:21 +00:00
|
|
|
|
public DotnetTestCommand() : base("dotnet")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override CommandResult Execute(string args = "")
|
|
|
|
|
{
|
2016-11-04 05:12:33 +00:00
|
|
|
|
args = $"test {GetRuntime()} {args}";
|
2016-03-08 23:53:21 +00:00
|
|
|
|
return base.Execute(args);
|
|
|
|
|
}
|
2016-04-29 20:46:16 +00:00
|
|
|
|
|
|
|
|
|
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
|
|
|
|
{
|
2016-11-04 05:12:33 +00:00
|
|
|
|
args = $"test {GetRuntime()} {args}";
|
2016-04-29 20:46:16 +00:00
|
|
|
|
return base.ExecuteWithCapturedOutput(args);
|
|
|
|
|
}
|
2016-11-04 05:12:33 +00:00
|
|
|
|
|
|
|
|
|
public DotnetTestCommand WithRuntime(string runtime)
|
|
|
|
|
{
|
|
|
|
|
_runtime = runtime;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetRuntime()
|
|
|
|
|
{
|
|
|
|
|
if (_runtime == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $"/p:RuntimeIdentifier={_runtime}";
|
|
|
|
|
}
|
2016-03-08 23:53:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|