public void GivenPathSetItPrintsInstruction(string toolsDirectoryOnPath) { BufferedReporter reporter = new BufferedReporter(); BashPathUnderHomeDirectory toolsPath = new BashPathUnderHomeDirectory( "/home/user", ".dotnet/tools"); string pathValue = @"/usr/bin"; Mock <IEnvironmentProvider> provider = new Mock <IEnvironmentProvider>(MockBehavior.Strict); provider .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue + ":" + toolsDirectoryOnPath); provider .Setup(p => p.GetEnvironmentVariable("SHELL")) .Returns("/bin/zsh"); OsxZshEnvironmentPathInstruction environmentPath = new OsxZshEnvironmentPathInstruction( toolsPath, reporter, provider.Object); environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); reporter.Lines.Should().Equal( string.Format( CommonLocalizableStrings.EnvironmentPathOSXZshManualInstructions, toolsPath.Path)); }
public void GivenPathSetItPrintsNothing(string toolsDirectoryOnPath) { BufferedReporter reporter = new BufferedReporter(); BashPathUnderHomeDirectory toolsPath = new BashPathUnderHomeDirectory( "/home/user", ".dotnet/tools"); string pathValue = @"/usr/bin"; Mock <IEnvironmentProvider> provider = new Mock <IEnvironmentProvider>(MockBehavior.Strict); provider .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue + ":" + toolsDirectoryOnPath); OsxZshEnvironmentPathInstruction environmentPath = new OsxZshEnvironmentPathInstruction( toolsPath, reporter, provider.Object); environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); reporter.Lines.Should().BeEmpty(); }