private void WriteExamples(TestStack.BDDfy.Scenario exampleScenario, IEnumerable <TestStack.BDDfy.Scenario> scenarioGroup)
        {
            WriteLine("Examples: ");
            var scenarios      = scenarioGroup.ToArray();
            var allPassed      = scenarios.All(s => s.Result == Result.Passed);
            var exampleColumns = exampleScenario.Example.Headers.Length;
            var numberColumns  = allPassed ? exampleColumns : exampleColumns + 2;
            var maxWidth       = new int[numberColumns];
            var rows           = new List <string[]>();

            Action <IEnumerable <string>, string, string> addRow = (cells, result, error) =>
            {
                var row   = new string[numberColumns];
                var index = 0;

                foreach (var cellText in cells)
                {
                    row[index++] = cellText;
                }

                if (!allPassed)
                {
                    row[numberColumns - 2] = result;
                    row[numberColumns - 1] = error;
                }

                for (var i = 0; i < numberColumns; i++)
                {
                    var rowValue = row[i];
                    if (rowValue != null && rowValue.Length > maxWidth[i])
                    {
                        maxWidth[i] = rowValue.Length;
                    }
                }

                rows.Add(row);
            };

            addRow(exampleScenario.Example.Headers, "Result", "Errors");
            foreach (var scenario in scenarios)
            {
                var failingStep = scenario.Steps.FirstOrDefault(s => s.Result == Result.Failed);
                var error       = failingStep == null
                ? null
                : string.Format("Step: {0} failed with exception: {1}", failingStep.Title, CreateExceptionMessage(failingStep));

                addRow(scenario.Example.Values.Select(e => e.GetValueAsString()), scenario.Result.ToString(), error);
            }

            foreach (var row in rows)
            {
                WriteExampleRow(row, maxWidth);
            }
        }
        void ReportOnStep(TestStack.BDDfy.Scenario scenario, Tuple <Step, string[]> stepAndLines, bool includeResults)
        {
            if (!includeResults)
            {
                foreach (var line in stepAndLines.Item2)
                {
                    WriteLine("\t{0}", line);
                }
                return;
            }

            var step            = stepAndLines.Item1;
            var humanizedResult = Configurator.Scanners.Humanize(step.Result.ToString());

            string message;

            if (scenario.Result == Result.Passed)
            {
                message = string.Format("\t{0}", stepAndLines.Item2[0]);
            }
            else
            {
                var paddedFirstLine = stepAndLines.Item2[0].PadRight(_longestStepSentence.Value + 5);
                message = string.Format("\t{0}  [{1}] ", paddedFirstLine, humanizedResult);
            }

            if (stepAndLines.Item2.Length > 1)
            {
                message = string.Format("{0}\r\n{1}", message, string.Join("\r\n", stepAndLines.Item2.Skip(1)));
            }

            if (step.Exception != null)
            {
                message += CreateExceptionMessage(step);
            }

            WriteLine(message);
        }
 void Report(TestStack.BDDfy.Scenario scenario)
 {
     WriteLine();
     WriteLine("Scenario: " + scenario.Title);
 }