Inheritance: ISettings
        public IEnumerable<string> GetRepositorySources(string path)
        {
            var configFileSystem = new PhysicalFileSystem(path);

            ISettings settings;
            if (_fileSystem.FileExists(Path.Combine(_fileSystem.CurrentDirectory, Constants.NugetFile)))
            {
                settings = new Settings(configFileSystem, Constants.NugetFile);
            }
            else
            {
                settings = Settings.LoadDefaultSettings(configFileSystem, null, new NugetMachineWideSettings());
            }

            if (settings == null)
            {
                return new[] { Constants.DefaultRepositoryUrl };
            }

            var sourceProvider = new PackageSourceProvider(settings);
            var sources = sourceProvider.LoadPackageSources().Where(i => i.IsEnabled == true);

            if (sources == null || !sources.Any())
            {
                return new[] { Constants.DefaultRepositoryUrl };
            }

            return sources.Select(i => i.Source);
        }
        /// <summary>
        /// Creates a settings instance from the supplied configuration XML
        /// </summary>
        private Settings CreateSettingsFromXml(string configXml)
        {
            // The simplest way to create a NuGet.Settings instance is to load
            // from an XML file on disk

            // Note: it's best to use local package sources for enabled packages
            // i.e. references to local directories. The directories do not have
            // to exist.
            // If you reference a remote package source such as https://www.nuget.org/api/v2/
            // then the repository factory will attempt to contact the remote repo
            // (which is slow) and will fail if it cannot be reached.
            var fullConfigPath = WriteConfigFile(configXml);
            var configDir      = Path.GetDirectoryName(fullConfigPath);
            var configFileName = Path.GetFileName(fullConfigPath);

            Settings settings = new NuGet.Settings(new NuGet.PhysicalFileSystem(configDir), configFileName);

            return(settings);
        }
        /// <summary>
        /// Creates a settings instance from the supplied configuration XML
        /// </summary>
        private Settings CreateSettingsFromXml(string configXml)
        {
            // The simplest way to create a NuGet.Settings instance is to load
            // from an XML file on disk

            // Note: it's best to use local package sources for enabled packages
            // i.e. references to local directories. The directories do not have
            // to exist.
            // If you reference a remote package source such as https://www.nuget.org/api/v2/
            // then the repository factory will attempt to contact the remote repo
            // (which is slow) and will fail if it cannot be reached.
            string testDir            = TestUtils.CreateTestDirectory(this.TestContext);
            string fullConfigFilePath = Path.Combine(testDir, "validConfig.txt");

            File.WriteAllText(fullConfigFilePath, configXml);

            Settings settings = new NuGet.Settings(new NuGet.PhysicalFileSystem(testDir), "validConfig.txt");

            return(settings);
        }
        /// <summary>
        /// Creates a settings instance from the supplied configuration XML
        /// </summary>
        private Settings CreateSettingsFromXml(string configXml)
        {
            // The simplest way to create a NuGet.Settings instance is to load
            // from an XML file on disk

            // Note: it's best to use local package sources for enabled packages
            // i.e. references to local directories. The directories do not have 
            // to exist.
            // If you reference a remote package source such as https://www.nuget.org/api/v2/
            // then the repository factory will attempt to contact the remote repo
            // (which is slow) and will fail if it cannot be reached.
            string testDir = TestUtils.CreateTestDirectory(this.TestContext);            
            string fullConfigFilePath = Path.Combine(testDir, "validConfig.txt");
            File.WriteAllText(fullConfigFilePath, configXml);

            Settings settings = new NuGet.Settings(new NuGet.PhysicalFileSystem(testDir), "validConfig.txt");
            return settings;
        }