public void Run(ExampleContext exampleContext) { try { m_example(exampleContext); m_report += "-"; } catch (Exception exception) { m_failures++; m_errorLog += m_name + " >> " + exception.GetType() + ": " + exception.Message + "\n" + exception.StackTrace + "\n"; m_report += "X"; } m_report += " " + m_name + "\n"; }
// TODO: Extract reporting // TODO: Fix this null-defaulted parameter - it's because a top-level ExampleGroup creates the first context public void Run(ExampleContext inheritedContext = null) { m_report += "Example group: " + m_name + "\n"; foreach (var specComponent in m_specComponents) { var context = new ExampleContext(m_letExpressions); specComponent.Run(context); m_run += specComponent.ExamplesRun; m_failures += specComponent.ExamplesFailed; m_report += specComponent.Report; m_errorLog += specComponent.ErrorLog; } m_status = String.Format("{0} run, {1} failures", m_run, m_failures); }