public void TestCreateResultsNodeNoResultsName() { WsScanRules scanRules = new WsScanRules(); WsScanRule findSomeRule = new WsScanRule("Find some", "FindSomeIndex", "some", RuleLevels.High); findSomeRule.Ranges.Add(RangeTypes.Paragraph); scanRules.Add(findSomeRule); XMLContentBuilder xmlContentBuilder = new XMLContentBuilder(scanRules); WsMatchInRangeCollection results = new WsMatchInRangeCollection(); ArrayList someData = new ArrayList(); someData.Add("Some"); someData.Add("Some"); someData.Add("some"); results.Add(new WsMatchInRange(RangeTypes.Paragraph, findSomeRule.Condition, someData)); string expectedResultsXml = "<results>" + "<result match=\"some\" context=\"Paragraph\" count=\"1\" />" + "<result match=\"Some\" context=\"Paragraph\" count=\"2\" />" + "</results>"; if (Is64Bit()) expectedResultsXml = "<results>" + "<result match=\"Some\" context=\"Paragraph\" count=\"2\" />" + "<result match=\"some\" context=\"Paragraph\" count=\"1\" />" + "</results>"; XmlDocument xmlDocument = new XmlDocument(); XmlElement resultsElement = xmlContentBuilder.CreateResultsNode(xmlDocument, findSomeRule, results); Assert.AreEqual(expectedResultsXml, resultsElement.OuterXml); }
public void TestCreateNullResultsNode() { WsScanRules scanRules = new WsScanRules(); WsScanRule scanRule = new WsScanRule("Find some", "FindSomeIndex", "some", RuleLevels.High); scanRules.Add(scanRule); XmlDocument xmlDocument = new XmlDocument(); XMLContentBuilder xmlContentBuilder = new XMLContentBuilder(scanRules); xmlContentBuilder.CreateResultsNode(xmlDocument, scanRule, null); }
public void TestCreateResultsNodeNoResults() { WsScanRules scanRules = new WsScanRules(); WsScanRule scanRule = new WsScanRule("Find some", "FindSomeIndex", "some", RuleLevels.High); scanRules.Add(scanRule); XmlDocument xmlDocument = new XmlDocument(); XMLContentBuilder xmlContentBuilder = new XMLContentBuilder(scanRules); WsMatchInRangeCollection results = new WsMatchInRangeCollection(); XmlElement resultsElement = xmlContentBuilder.CreateResultsNode(xmlDocument, scanRule, results); Assert.IsNull(resultsElement, "Expected a null results node for no results"); }
public void TestCreateResultsNodeNullScanRule() { WsScanRules scanRules = new WsScanRules(); WsScanRule scanRule = new WsScanRule("Find some", "FindSomeIndex", "some", RuleLevels.High); scanRules.Add(scanRule); XmlDocument xmlDocument = new XmlDocument(); XMLContentBuilder xmlContentBuilder = new XMLContentBuilder(scanRules); WsMatchInRangeCollection results = new WsMatchInRangeCollection(); xmlContentBuilder.CreateResultsNode(xmlDocument, null, results); }