dotnet-installer/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs

42 lines
1.1 KiB
C#
Raw Normal View History

// Copyright (c) .NET Foundation and contributors. All rights reserved.
2015-12-15 01:39:29 +00:00
// 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
2015-12-15 01:39:29 +00:00
{
public sealed class RestoreCommand : DotnetCommand
2015-12-15 01:39:29 +00:00
{
2016-10-31 23:22:10 +00:00
private string _runtime;
public RestoreCommand WithRuntime(string runtime)
{
_runtime = runtime;
return this;
}
public override CommandResult Execute(string args = "")
2015-12-15 01:39:29 +00:00
{
2016-10-31 23:22:10 +00:00
args = $"restore {GetRuntime()} {args} --disable-parallel";
2015-12-15 01:39:29 +00:00
return base.Execute(args);
}
public override CommandResult ExecuteWithCapturedOutput(string args = "")
{
2016-10-31 23:22:10 +00:00
args = $"restore {GetRuntime()} {args} --disable-parallel";
return base.ExecuteWithCapturedOutput(args);
}
2016-10-31 23:22:10 +00:00
private string GetRuntime()
{
if (_runtime == null)
{
return null;
}
return $"-property:RuntimeIdentifier={_runtime}";
2016-10-31 23:22:10 +00:00
}
2015-12-15 01:39:29 +00:00
}
}