public override void Validate(object sender, ValidationEventArgs e)
        {
            base.Validate(sender, e);

            if (((WebTestRequest)e.WebTestItem).ResponseUrl.Equals(_expectedResponseUrl))
            {
                _context.Outcome = WebTestOutcome.Passed;
            }
            else
            {
                _context.Outcome = WebTestOutcome.Failed;
            }
        }
        /// <summary>
        /// When overridden in a derived class, this validates both the request and response.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public virtual void Validate(Object sender, ValidationEventArgs e)
        {
            _context.Outcome = WebTestOutcome.NotExecuted;

            HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
            document.LoadHtml(((WebTestRequest)e.WebTestItem).HttpResponseBody);
            document.OptionOutputAsXml = true;

            using (StringWriter writer = new StringWriter())
            {
                document.Save(writer);

                _document = XDocument.Parse(writer.GetStringBuilder().ToString());
            }
        }
 /// <summary>
 /// Fires Validate event.
 /// </summary>
 /// <param name="args"></param>
 protected virtual void OnValidate(ValidationEventArgs args)
 {
     if (ValidateResponse != null)
     {
         ValidateResponse(this, args);
     }
 }