private XElement FormatHeading(ScenarioOutline scenarioOutline)
        {
            if (string.IsNullOrEmpty(scenarioOutline.Name))
            {
                return(null);
            }

            var result = new XElement(
                this.xmlns + "div",
                new XAttribute("class", "scenario-heading"),
                string.IsNullOrEmpty(scenarioOutline.Slug) ? null : new XAttribute("id", scenarioOutline.Slug),
                new XElement(this.xmlns + "h2", scenarioOutline.Name));

            var tags = RetrieveTags(scenarioOutline);

            if (tags.Length > 0)
            {
                var paragraph = new XElement(this.xmlns + "p", HtmlScenarioFormatter.CreateTagElements(tags.OrderBy(t => t).ToArray(), this.xmlns));
                paragraph.Add(new XAttribute("class", "tags"));
                result.Add(paragraph);
            }

            result.Add(this.htmlDescriptionFormatter.Format(scenarioOutline.Description));

            return(result);
        }
 public void Setup()
 {
     this.formatter = new HtmlScenarioFormatter(
         Container.Resolve<HtmlStepFormatter>(),
         Container.Resolve<HtmlDescriptionFormatter>(),
         Container.Resolve<HtmlImageResultFormatter>());
 }
Esempio n. 3
0
 public HtmlFeatureFormatter(
     HtmlScenarioFormatter htmlScenarioFormatter,
     HtmlDescriptionFormatter htmlDescriptionFormatter,
     HtmlScenarioOutlineFormatter htmlScenarioOutlineFormatter,
     HtmlImageResultFormatter htmlImageResultFormatter)
 {
     this.htmlScenarioFormatter = htmlScenarioFormatter;
     this.htmlScenarioOutlineFormatter = htmlScenarioOutlineFormatter;
     this.htmlDescriptionFormatter = htmlDescriptionFormatter;
     this.htmlImageResultFormatter = htmlImageResultFormatter;
     this.xmlns = HtmlNamespace.Xhtml;
 }
Esempio n. 4
0
 public HtmlFeatureFormatter(
     HtmlScenarioFormatter htmlScenarioFormatter,
     HtmlDescriptionFormatter htmlDescriptionFormatter,
     HtmlScenarioOutlineFormatter htmlScenarioOutlineFormatter,
     HtmlImageResultFormatter htmlImageResultFormatter)
 {
     this.htmlScenarioFormatter        = htmlScenarioFormatter;
     this.htmlScenarioOutlineFormatter = htmlScenarioOutlineFormatter;
     this.htmlDescriptionFormatter     = htmlDescriptionFormatter;
     this.htmlImageResultFormatter     = htmlImageResultFormatter;
     this.xmlns = HtmlNamespace.Xhtml;
 }
Esempio n. 5
0
        public XElement Format(Feature feature)
        {
            var div = new XElement(
                this.xmlns + "div",
                new XAttribute("id", "feature"),
                this.htmlImageResultFormatter.Format(feature),
                new XElement(this.xmlns + "h1", feature.Name));

            var tags = RetrieveTags(feature);

            if (tags.Length > 0)
            {
                var paragraph = new XElement(this.xmlns + "p", HtmlScenarioFormatter.CreateTagElements(tags.OrderBy(t => t).ToArray(), this.xmlns));
                paragraph.Add(new XAttribute("class", "tags"));
                div.Add(paragraph);
            }

            div.Add(this.htmlDescriptionFormatter.Format(feature.Description));

            var scenarios = new XElement(this.xmlns + "ul", new XAttribute("id", "scenarios"));
            int id        = 0;

            if (feature.Background != null)
            {
                scenarios.Add(this.htmlScenarioFormatter.Format(feature.Background, id++));
            }

            foreach (IFeatureElement featureElement in feature.FeatureElements)
            {
                var scenario = featureElement as Scenario;
                if (scenario != null)
                {
                    scenarios.Add(this.htmlScenarioFormatter.Format(scenario, id++));
                }

                var scenarioOutline = featureElement as ScenarioOutline;
                if (scenarioOutline != null)
                {
                    scenarios.Add(this.htmlScenarioOutlineFormatter.Format(scenarioOutline, id++));
                }
            }

            div.Add(scenarios);

            return(div);
        }