public void Format(Body body, ScenarioOutline scenarioOutline)
        {
            if (configuration.HasTestResults)
            {
                TestResult testResult = testResults.GetScenarioOutlineResult(scenarioOutline);
                if (testResult.WasExecuted && testResult.WasSuccessful)
                {
                    body.GenerateParagraph("Passed", "Passed");
                }
                else if (testResult.WasExecuted && !testResult.WasSuccessful)
                {
                    body.GenerateParagraph("Failed", "Failed");
                }
            }

            body.GenerateParagraph(scenarioOutline.Name, "Heading2");
            if (!string.IsNullOrEmpty(scenarioOutline.Description))
            {
                body.GenerateParagraph(scenarioOutline.Description, "Normal");
            }

            foreach (Step step in scenarioOutline.Steps)
            {
                wordStepFormatter.Format(body, step);
            }

            body.GenerateParagraph("Examples:", "Heading3");
            wordTableFormatter.Format(body, scenarioOutline.Example.TableArgument);
        }
Exemple #2
0
        public void Format(Body body, Step step)
        {
            // HACK - We need to generate a custom paragraph here because 2 Run objects are needed to allow for the bolded keyword
            var paragraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId {
                Val = "Normal"
            }));

            paragraph.Append(new Run(new RunProperties(new Bold()), new Text(step.NativeKeyword)));
            var nameText = new Text {
                Space = SpaceProcessingModeValues.Preserve
            };

            nameText.Text = " " + step.Name;
            paragraph.Append(new Run(nameText));
            body.Append(paragraph);

            if (!string.IsNullOrEmpty(step.DocStringArgument))
            {
                string[] lines = step.DocStringArgument.Split(new[] { Environment.NewLine },
                                                              StringSplitOptions.RemoveEmptyEntries);
                foreach (string line in lines)
                {
                    body.GenerateParagraph(line, "Quote");
                }
            }

            if (step.TableArgument != null)
            {
                wordTableFormatter.Format(body, step.TableArgument);
            }
        }