Ejemplo n.º 1
0
    /// <summary>
    /// Reports the failed information of the specified fixture running results.
    /// </summary>
    /// <param name="results">The fixture running results.</param>
    protected virtual void ReportFailedInformation(IEnumerable <FixtureResult> results)
    {
        results.ForEach(result =>
        {
            if (result.Exception is not null)
            {
                EnsureFailureTitle();
                CarnaConsole.WriteFailure($"{++FailureCount}) ");
                CarnaConsole.WriteLineFailure(result.Exception);
                CarnaConsole.WriteLine();
            }

            if (result.StepExceptions.Any())
            {
                ++FailureCount;
            }

            result.StepExceptions.ForEachWithIndex((exception, index) =>
            {
                EnsureFailureTitle();
                CarnaConsole.WriteFailure($"{FailureCount}-{index + 1}) ");
                CarnaConsole.WriteLineFailure(exception);
                CarnaConsole.WriteLine();
            });

            ReportFailedInformation(result.Results);
        });
    }
Ejemplo n.º 2
0
 private void ReportFailedCount(int failedCount)
 {
     CarnaConsole.WriteItem("Failed: ");
     if (failedCount == 0)
     {
         CarnaConsole.WriteValue(failedCount);
     }
     else
     {
         CarnaConsole.WriteFailure(failedCount);
     }
 }
Ejemplo n.º 3
0
    /// <summary>
    /// Reports the specified value with the specified status of the fixture step running.
    /// </summary>
    /// <param name="value">The value to be reported.</param>
    /// <param name="status">The status of the fixture step running.</param>
    /// <param name="lineBreak">
    /// <c>true</c> if a line break is required; otherwise, <c>false</c>.
    /// </param>
    protected virtual void ReportValue(string value, FixtureStepStatus status, bool lineBreak = false)
    {
        switch (status)
        {
        case FixtureStepStatus.Ready: CarnaConsole.WriteReady(value); break;

        case FixtureStepStatus.Pending: CarnaConsole.WritePending(value); break;

        case FixtureStepStatus.Failed: CarnaConsole.WriteFailure(value); break;

        case FixtureStepStatus.None: CarnaConsole.WriteNote(value); break;

        default: CarnaConsole.WriteValue(value); break;
        }

        if (lineBreak)
        {
            CarnaConsole.WriteLine();
        }
    }