05052c0541
To ensure the mock has the same behavior the component has, run mock under the same tests the adapter has. It is a common problem that moq has -- "everything is mocked out, you are not test anything"
39 lines
1.3 KiB
C#
39 lines
1.3 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 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("INSTRUCTION");
|
|
}
|
|
}
|
|
|
|
private bool PackageExecutablePathExists()
|
|
{
|
|
return _packageExecutablePathExists;
|
|
}
|
|
}
|
|
}
|