internal override void Load(XmlNode testConfig, Context context)
 {
     GoalFilePath = context.ReadConfigAsString(testConfig, "GoalFile");
     SearchDirectory = context.ReadConfigAsString(testConfig, "SearchDirectory");
     Filter = context.ReadConfigAsString(testConfig, "Filter");
     Timeout = context.ReadConfigAsUInt32(testConfig, "Timeout");
     DeleteFile = context.ReadConfigAsBool(testConfig, "DeleteFile", true);
     Exclusions = ParseExclusions(testConfig);
 }
 internal override void Load(XmlNode testConfig, Context context)
 {
     GoalFilePath = context.ReadConfigAsString(testConfig, "GoalFile");
     SearchDirectory = context.ReadConfigAsString(testConfig, "SearchDirectory");
     Filter = context.ReadConfigAsString(testConfig, "Filter");
     Timeout = context.ReadConfigAsUInt32(testConfig, "Timeout");
     DeleteFile = context.ReadConfigAsBool(testConfig, "DeleteFile", true);
     IgnoreChildOrder = context.ReadConfigAsBool(testConfig, "IgnoreChildOrder", true);
     IgnoreComments = context.ReadConfigAsBool(testConfig, "IgnoreComments", true);
     ElementsToExclude = ParseElementExclusions(testConfig);
     AttributesToExclude = ParseAttributeExclusions(testConfig);
     StringsToSearchAndReplace = ParseReplacements(testConfig);
 }
Example #3
0
		/// <summary>
		/// ITestStep.Execute() implementation
		/// </summary>
		/// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
		/// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
		public void Execute(System.Xml.XmlNode testConfig , Context context)
		{
			// Using Policy Tester
			 
			// Retrieve Rule-Set from Policy file
			string RuleStoreName = context.ReadConfigAsString(testConfig, "RuleStoreName");
			string RuleSetInfoCollectionName =context.ReadConfigAsString(testConfig, "RuleSetInfoCollectionName");
			string DebugTracking = context.ReadConfigAsString(testConfig, "DebugTracking");
			string SampleXML = context.ReadConfigAsString(testConfig, "SampleXML");
			string XSD = context.ReadConfigAsString(testConfig, "XSD");
			string ResultFile = context.ReadConfigAsString(testConfig, "ResultFile");

			RuleStore ruleStore = new FileRuleStore(RuleStoreName);
			RuleSetInfoCollection rsInfo = ruleStore.GetRuleSets(RuleSetInfoCollectionName, RuleStore.Filter.Latest);
			if (rsInfo.Count != 1)
			{
				// oops ... error
				throw new ApplicationException();
			}
			
			RuleSet ruleset = ruleStore.GetRuleSet(rsInfo[0]);
			
			// Create an instance of the DebugTrackingInterceptor
			DebugTrackingInterceptor dti = new DebugTrackingInterceptor(DebugTracking);

			// Create an instance of the Policy Tester class
			PolicyTester policyTester = new PolicyTester(ruleset);

			XmlDocument xd1 = new XmlDocument();
			xd1.Load(SampleXML);
								
			TypedXmlDocument doc1 = new TypedXmlDocument(XSD, xd1);

			// Execute Policy Tester
			try
			{
				policyTester.Execute(doc1, dti);
			}
			catch (Exception e) 
			{
				context.LogException(e);
				throw;
			}
			
			FileInfo f = new FileInfo(ResultFile);
			StreamWriter w = f.CreateText();
			w.Write(doc1.Document.OuterXml);
			w.Close();
		}