Exemplo n.º 1
0
        /// <summary>
        /// Copies test sources configuration to a test folder
        /// </summary>
        public static string CopyFuncTestConfig(string destinationFolder)
        {
            var testSettingsFolder = TestSources.GetConfigFileRoot();
            var funcTestConfigPath = Path.Combine(testSettingsFolder, TestSources.ConfigFile);

            var destConfigFile = Path.Combine(destinationFolder, "NuGet.Config");

            File.Copy(funcTestConfigPath, destConfigFile);
            return(destConfigFile);
        }
Exemplo n.º 2
0
        public static string ReadApiKey(string feedName)
        {
            var testSettingsFolder = TestSources.GetConfigFileRoot();
            var protocolConfigPath = Path.Combine(testSettingsFolder, ProtocolConfigFileName);

            var fullPath = NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory);

            using (Stream configStream = File.OpenRead(protocolConfigPath))
            {
                var doc     = XDocument.Load(XmlReader.Create(configStream));
                var element = doc.Root.Element(feedName);

                return(element?.Element("ApiKey")?.Value);
            }
        }