コード例 #1
0
        public void FindInstallationDirectoryInPathContaining_ShouldLookAtDefaultEvenIfNotInPath()
        {
            string chefPath = $@"{ChefProcessTest.ChefInstallPath}\bin";
            var    chefClientFileExclusively = @"chef-client.bat";
            var    chefClientFile            = $@"{chefPath}\{chefClientFileExclusively}";
            var    fileSystem = new FileSystem(ChefProcessTest.CreateEnvironmentWithPath(string.Empty),
                                               FakeFileSystemCommands.CreateWithExistingFiles(chefClientFile));

            fileSystem.FindInstallationDirectoryInPathContaining(chefClientFileExclusively, chefPath).Should()
            .Be(chefPath, "because even if it's not in the path, the default chef path should be used");
        }
コード例 #2
0
        public void FindChefInstallationDirectory_ShouldFindChefFileThatExistsInPathEnvironmentVariable()
        {
            string chefPath = $@"{ChefProcessTest.ChefInstallPath}\bin";
            var    path     = $@"C:\something;C:\else;{chefPath}";
            var    chefClientFileExclusively = @"chef-client.bat";
            var    chefClientFile            = $@"{chefPath}\{chefClientFileExclusively}";
            var    fileSystem = new FileSystem(ChefProcessTest.CreateEnvironmentWithPath(path),
                                               FakeFileSystemCommands.CreateWithExistingFiles(chefClientFile));

            fileSystem.FindInstallationDirectoryInPathContaining(chefClientFileExclusively, @"C:\default").Should()
            .Be(chefPath, "because it is the parent directory of the bin path in which the batch file exists");
        }