public void Identifies_missing_header_in_complex_document() { var html = new StringBuilder(); html.Append("<h1 />"); html.Append("<div>"); html.Append(" <h2 />"); html.Append(" <div>"); html.Append(" <h3 />"); html.Append(" </div>"); html.Append(" <h2 />"); html.Append(" <div />"); html.Append(" <div>"); html.Append(" <div>"); html.Append(" <h4 />"); html.Append(" </div>"); html.Append(" <h2 />"); html.Append(" <div>"); html.Append(" <h3 />"); html.Append(" </div>"); html.Append(" </div>"); html.Append("</div>"); var errors = new HeadingsAreLogicallyOrdered().ValidateHtml(html); errors.Length.ShouldEqual(1); errors[0].Message.ShouldEqual( @"Illogical heading order: Expected to find <h3> but found <h4 /> instead"); }
public void Identifies_missing_h1_tag() { var errors = new HeadingsAreLogicallyOrdered().ValidateHtml(@"<div><h2>Second-Level Heading</h2></div>"); errors.Length.ShouldEqual(1); errors[0].Message.ShouldEqual( @"Illogical heading order: Expected to find <h1> but found <h2>Second-Level Heading</h2> instead"); }