0598e6cb70
* Change to escape string via XML * tool-path option -- "Session tool" From the beginning design, shim and packageInstaller take package location from constructor and don't have assumption anymore. From previous discussion, tool-path will simply change global location to the one user want, and everything else is the same. However, this "override" need to happen during the call, that means InstallToolCommand will create different shim and packageInstaller object according to the tool-path during the call instead of constructor DI. * global package location change * block of leading dot as command name * Localization of tool-path option
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
// 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;
|
|
using Microsoft.DotNet.Cli.Utils;
|
|
|
|
namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
|
|
{
|
|
internal class EnvironmentPathInstructionMock : IEnvironmentPathInstruction
|
|
{
|
|
private readonly string _packageExecutablePath;
|
|
private readonly bool _packageExecutablePathExists;
|
|
private readonly IReporter _reporter;
|
|
public const string MockInstructionText = "MOCK INSTRUCTION";
|
|
|
|
public EnvironmentPathInstructionMock(
|
|
IReporter reporter,
|
|
string packageExecutablePath,
|
|
bool packageExecutablePathExists = false)
|
|
{
|
|
_packageExecutablePath =
|
|
packageExecutablePath ?? throw new ArgumentNullException(nameof(packageExecutablePath));
|
|
_reporter = reporter ?? throw new ArgumentNullException(nameof(reporter));
|
|
_packageExecutablePathExists = packageExecutablePathExists;
|
|
}
|
|
|
|
public void PrintAddPathInstructionIfPathDoesNotExist()
|
|
{
|
|
if (!PackageExecutablePathExists())
|
|
{
|
|
_reporter.WriteLine(MockInstructionText);
|
|
}
|
|
}
|
|
|
|
private bool PackageExecutablePathExists()
|
|
{
|
|
return _packageExecutablePathExists;
|
|
}
|
|
}
|
|
}
|