Пример #1
0
        public void GlobalSetup()
        {
            _provider = new XmlConfigurationProvider(new XmlConfigurationSource());

            using (FileStream fileStream = File.OpenRead(Path.Combine("./libraries/Microsoft.Extensions.Configuration.Xml/TestFiles", FileName)))
            {
                _memoryStream = new MemoryStream();

                fileStream.CopyTo(_memoryStream);
            }
        }
 public static IConfiguration LoadXml(string configFile)
 {
     var config = new ConfigurationBuilder();
     var source = new XmlConfigurationProvider("path");
     using (var stream = typeof(EmbeddedConfiguration).GetTypeInfo().Assembly.GetManifestResourceStream("Autofac.Configuration.Test.Files." + configFile))
     {
         typeof(XmlConfigurationProvider).GetMethod("Load", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(source, new object[] { stream });
     }
     config.Add(source, false);
     return config.Build();
 }