protected static void AssertHtmlRulePasses(IHtmlRule htmlRule, string bodyHtml) { var document = GetDocument(bodyHtml); var records = htmlRule.ValidateHtml(document, GetNamespaceManager(document)); Assert.That(records.Length, Is.EqualTo(0)); }
protected void ExecuteTest(IHtmlRule rule, string bodyHtml) { XmlDocument document = GetDocument(bodyHtml); XmlNamespaceManager namespaceManager = GetNamespaceManager(document); _errors = rule.ValidateHtml(document, namespaceManager); }
protected static void AssertHtmlRuleFails(IHtmlRule htmlRule, string bodyHtml, int lineNumber, int linePosition, string message) { XmlDocument document = GetDocument(bodyHtml); XmlNamespaceManager namespaceManager = GetNamespaceManager(document); IHtmlRule rule = htmlRule; var records = rule.ValidateHtml(document, namespaceManager); Assert.That(records.Length, Is.EqualTo(1)); Assert.That(records[0].Message, Is.EqualTo(message)); }
public bool ShouldRuleBeIncludedBasedOnConfiguration(IHtmlRule rule) { string ruleName = rule.GetType().Name; string appSetting = ConfigurationManager.AppSettings["NaakRules"]; string[] configuredRules = appSetting == null ? new string[0] : appSetting.Split(','); bool ruleConfigurationNotSpecified = configuredRules.Length == 0; bool includeRule = ruleConfigurationNotSpecified || configuredRules.Any(s => s.Trim() == ruleName); return(includeRule); }