public void ProcessConfigFile_GetSettingsForWorkingDirectory(string emptyConfig) { ISettings settings = XPlatUtility.ProcessConfigFile(emptyConfig); var baseDirectory = NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory); string baseNugetConfigPath = Path.Combine(baseDirectory, Settings.DefaultSettingsFileName); List <string> configPaths = settings.GetConfigFilePaths().ToList(); // Since this command doesn't set specific working directory itself, it's just test binary folder, // so several nuget.config including user default nuget.config'll get loaded. Assert.True(configPaths.Count > 1); // Assert user default nuget.config is loaded Assert.True(configPaths.Contains(baseNugetConfigPath)); }
public void ProcessConfigFile_PassConfigFile_OnlyPassedConfigLoaded() { using (var pathContext = new SimpleTestPathContext()) { string currentFolderNugetConfigPath = Path.Combine(pathContext.WorkingDirectory, Settings.DefaultSettingsFileName); var tempFolder = Path.Combine(pathContext.WorkingDirectory, "Temp"); string tempFolderNuGetConfigPath = Path.Combine(tempFolder, Settings.DefaultSettingsFileName); Directory.CreateDirectory(tempFolder); File.Copy(currentFolderNugetConfigPath, tempFolderNuGetConfigPath); ISettings settings = XPlatUtility.ProcessConfigFile(tempFolderNuGetConfigPath); List <string> configPaths = settings.GetConfigFilePaths().ToList(); // If optional nuget.config passed then only that 1 file get loaded. Assert.Equal(1, configPaths.Count); Assert.True(configPaths.Contains(tempFolderNuGetConfigPath)); } }
public void MSBuildVerbosityToNuGetLogLevel_HasProperMapping(string verbosity, LogLevel expected) { LogLevel actual = XPlatUtility.MSBuildVerbosityToNuGetLogLevel(verbosity); Assert.Equal(expected, actual); }