/// <summary>
    /// Reports the fixture step running result that is contained by the specified fixture running result
    /// and the level of the fixture running result.
    /// </summary>
    /// <param name="result">The fixture running result.</param>
    /// <param name="level">The level of the fixture running result.</param>
    protected virtual void ReportFixtureStep(FixtureResult result, int level)
    {
        if (!StepVisible)
        {
            return;
        }

        var indent = Indent(level);

        result.StepResults.ForEach(stepResult =>
        {
            ReportValue(JoinFormattedLines(FixtureFormatter.FormatFixtureStep(stepResult.Step), indent), stepResult.Status);
            ReportStatus(stepResult.Status, true);
        });
    }
Example #2
0
    /// <summary>
    /// Reports the specified fixture step running result to the specified XML element.
    /// </summary>
    /// <param name="result">The fixture step running result.</param>
    /// <param name="element">The XML element to which the result is reported.</param>
    protected virtual void ReportFixtureStep(FixtureStepResult result, XElement element)
    {
        var stepElement = new XElement("step",
                                       new XAttribute("type", result.Step.GetType()),
                                       new XAttribute("description", result.Step.Description),
                                       new XAttribute("status", result.Status),
                                       new XAttribute("startTime", result.StartTime.GetValueOrDefault()),
                                       new XAttribute("endTime", result.EndTime.GetValueOrDefault()),
                                       new XAttribute("duration", result.Duration.GetValueOrDefault().TotalSeconds),
                                       new XAttribute("formattedDescription", FixtureFormatter.FormatFixtureStep(result.Step))
                                       );

        if (result.Exception is not null)
        {
            stepElement.Add(new XElement("exception", result.Exception));
        }

        element.Add(stepElement);
    }