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

            return(new XElement(xmlns + "div",
                                new XAttribute("class", "scenario-heading"),
                                new XElement(xmlns + "h2", scenarioOutline.Name),
                                htmlDescriptionFormatter.Format(scenarioOutline.Description)
                                ));
        }
 public XElement Format(Scenario scenario, int id)
 {
     return(new XElement(xmlns + "li",
                         new XAttribute("class", "scenario"),
                         htmlImageResultFormatter.Format(scenario),
                         new XElement(xmlns + "div",
                                      new XAttribute("class", "scenario-heading"),
                                      new XElement(xmlns + "h2", scenario.Name),
                                      htmlDescriptionFormatter.Format(scenario.Description)
                                      ),
                         new XElement(xmlns + "div",
                                      new XAttribute("class", "steps"),
                                      new XElement(xmlns + "ul",
                                                   scenario.Steps.Select(step => htmlStepFormatter.Format(step)))
                                      )
                         ));
 }
Beispiel #3
0
        public XElement Format(Feature feature)
        {
            var div = new XElement(xmlns + "div",
                                   new XAttribute("id", "feature"),
                                   htmlImageResultFormatter.Format(feature),
                                   new XElement(xmlns + "h1", feature.Name),
                                   htmlDescriptionFormatter.Format(feature.Description)
                                   );

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

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

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

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

            div.Add(scenarios);

            return(div);
        }