public void GivenPathSetItPrintsNothing(string toolsDirectoryOnPath) { var reporter = new BufferedReporter(); var toolsPath = new BashPathUnderHomeDirectory("/home/user", ".dotnet/tools"); var pathValue = @"/usr/bin"; var provider = new Mock <IEnvironmentProvider>(MockBehavior.Strict); provider .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue + ":" + toolsDirectoryOnPath); var environmentPath = new OsxBashEnvironmentPath( toolsPath, reporter, provider.Object, FileSystemMockBuilder.Empty.File); environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); reporter.Lines.Should().BeEmpty(); }
public void GivenPathNotSetAndProfileExistsItPrintsReopenMessage() { var reporter = new BufferedReporter(); var toolsPath = new BashPathUnderHomeDirectory("/home/user", ".dotnet/tools"); var pathValue = @"/usr/bin"; var provider = new Mock <IEnvironmentProvider>(MockBehavior.Strict); provider .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue); var environmentPath = new OsxBashEnvironmentPath( toolsPath, reporter, provider.Object, new FileSystemMockBuilder() .AddFile(OsxBashEnvironmentPath.DotnetCliToolsPathsDPath, "") .Build() .File); environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); reporter.Lines.Should().Equal(CommonLocalizableStrings.EnvironmentPathOSXNeedReopen); }
public void GivenPathNotSetItPrintsManualInstructions() { var reporter = new BufferedReporter(); var toolsPath = new BashPathUnderHomeDirectory("/home/user", ".dotnet/tools"); var pathValue = @"/usr/bin"; var provider = new Mock <IEnvironmentProvider>(MockBehavior.Strict); provider .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue); var environmentPath = new OsxBashEnvironmentPath( toolsPath, reporter, provider.Object, FileSystemMockBuilder.Empty.File); environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); reporter.Lines.Should().Equal( string.Format( CommonLocalizableStrings.EnvironmentPathOSXBashManualInstructions, toolsPath.Path)); }