// Methods
 /// <summary>
 /// Initializes a new instance of the <see cref="PreprocessorEnvironment" /> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="inputFilePath">The input_file_path.</param>
 /// <param name="resolver">The resolver.</param>
 /// <remarks></remarks>
 public PreprocessorEnvironment(PreprocessorSettings settings, Uri inputFilePath,
                                XmlUrlResolver resolver)
 {
     _Settings             = settings;
     _DefaultNodeProcessor = new DefaultProcessor(this);
     // Bottom-most stack frame
     _define_stack.Push(new Dictionary <string, SymbolicDef>());
     // Record the input file as the outer-most "include"
     _include_stack.Push(inputFilePath);
     _fileset[inputFilePath] = true;
     _resolver = resolver;
     if (_Settings.InitialDefinitions != null)
     {
         foreach (var pair in _Settings.InitialDefinitions)
         {
             _DefineTextSymbol(pair.Key, pair.Value, false);
         }
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigPreprocessor" /> class.	
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <remarks></remarks>
 public ConfigPreprocessor(PreprocessorSettings settings)
 {
     _settings = settings;
 }
 private static XmlDocument _Preprocess(string filename, PreprocessorSettings settings )
 {
     using( XmlReader input = GetInput( filename ) )
     {
         using ( XmlWriter output = GetOutput() )
         {
             ConfigPreprocessor preprocessor = new ConfigPreprocessor( settings );
             preprocessor.PreProcess(
                 input, output, new TestResolver( FAKE_ROOT + filename  ), new Uri( FAKE_ROOT + filename  )  );
         }
         return ReadOutputDoc();
     }
 }
 public void TestInitialDefine2()
 {
     var settings = new PreprocessorSettings();
     var defs = new Dictionary<string, string>();
     defs["foo"] = "foo_val";
     settings.InitialDefinitions = defs;
     settings.ExplicitDeclarationRequired = true;
     XmlDocument doc = _Preprocess("TestExplicitDefine.xml", settings);
     XPathNavigator nav = doc.CreateNavigator();
     AssertNodeValue(nav, "/root/@foo", "foo_val");
 }
 public void TestExplicitDefine2()
 {
     var settings = new PreprocessorSettings();
     try
     {
         Environment.SetEnvironmentVariable("foo", "foo_val");
         settings.ExplicitDeclarationRequired = true;
         _Preprocess("TestExplicitDefine.xml", settings);
     }
     finally
     {
         Environment.SetEnvironmentVariable("foo", null);
     }
 }
 public void TestExplicitDefine1()
 {
     var settings = new PreprocessorSettings();
     Environment.SetEnvironmentVariable("foo", "foo_val");
     settings.ExplicitDeclarationRequired = false;
     XmlDocument doc = _Preprocess("TestExplicitDefine.xml", settings);
     XPathNavigator nav = doc.CreateNavigator();
     AssertNodeValue(nav, "/root/@foo", "foo_val");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigPreprocessor" /> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <remarks></remarks>
 public ConfigPreprocessor(PreprocessorSettings settings)
 {
     _settings = settings;
 }