/// <summary>Validates an element.</summary> /// <param name="element">The element.</param> /// <returns>True if element is valid otherwise false.</returns> public bool Validate(BaseHtmlElement element) { if (element == null) { throw new ArgumentNullException("element"); } return(string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase) && string.Equals(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName, StringComparison.InvariantCultureIgnoreCase)); }
/// <summary>Validates an element.</summary> /// <param name="element">The element.</param> /// <returns>True if element is valid otherwise false.</returns> public bool Validate(BaseHtmlElement element) { if (element == null) { throw new ArgumentNullException("element"); } return string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase) && string.Equals(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName, StringComparison.InvariantCultureIgnoreCase); }
/// <summary>Gets an error message for an invalid element.</summary> /// <param name="element">The invalid element.</param> /// <returns>The error message.</returns> public string GetErrorMessage(BaseHtmlElement element) { if (element == null) { throw new ArgumentNullException("element"); } return string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase) ? @"The attribute 'type=""{0}""' does not match to 'type=""{1}""'".F(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName) : "'{0}' tag does not match to '{1}' tag".F(element.TagName, HtmlElements.Input); }
/// <summary>Gets an error message for an invalid element.</summary> /// <param name="element">The invalid element.</param> /// <returns>The error message.</returns> public string GetErrorMessage(BaseHtmlElement element) { if (element == null) { throw new ArgumentNullException("element"); } return(string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase) ? @"The attribute 'type=""{0}""' does not match to 'type=""{1}""'".F(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName) : "'{0}' tag does not match to '{1}' tag".F(element.TagName, HtmlElements.Input)); }