2016-03-08 15:53:21 -08: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
|
|
|
|
|
{
|
2017-03-14 14:07:51 -07:00
|
|
|
|
public class DotnetTestCommand : DotnetCommand
|
2016-03-08 15:53:21 -08:00
|
|
|
|
{
|
2016-11-03 22:12:33 -07:00
|
|
|
|
private string _runtime;
|
|
|
|
|
|
2016-03-08 15:53:21 -08:00
|
|
|
|
public override CommandResult Execute(string args = "")
|
|
|
|
|
{
|
2016-11-03 22:12:33 -07:00
|
|
|
|
args = $"test {GetRuntime()} {args}";
|
2016-03-08 15:53:21 -08:00
|
|
|
|
return base.Execute(args);
|
|
|
|
|
}
|
2016-04-29 15:46:16 -05:00
|
|
|
|
|
|
|
|
|
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
|
|
|
|
{
|
2016-11-03 22:12:33 -07:00
|
|
|
|
args = $"test {GetRuntime()} {args}";
|
2016-04-29 15:46:16 -05:00
|
|
|
|
return base.ExecuteWithCapturedOutput(args);
|
|
|
|
|
}
|
2016-11-03 22:12:33 -07:00
|
|
|
|
|
|
|
|
|
public DotnetTestCommand WithRuntime(string runtime)
|
|
|
|
|
{
|
|
|
|
|
_runtime = runtime;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetRuntime()
|
|
|
|
|
{
|
|
|
|
|
if (_runtime == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-02 15:14:32 -07:00
|
|
|
|
return $"-property:RuntimeIdentifier={_runtime}";
|
2016-11-03 22:12:33 -07:00
|
|
|
|
}
|
2016-03-08 15:53:21 -08:00
|
|
|
|
}
|
|
|
|
|
}
|