public void Report(ScenarioRunResult result) { try { var writer = new DelayedBatchWriter(_queue); writer.Write(new StartScenario(result.Title ?? result.Scope, result.Scope, result.Grouping)); foreach (var given in result.Given) { writer.Write(given); } if (result.When != null) { writer.Write(result.When); } foreach (var then in result.Then) { writer.Write(then); } writer.Complete(); } catch (Exception ex) { _diagnosticMessageSinkessageSink.OnMessage( new DiagnosticMessage($"An error occured reading scenario result:{Environment.NewLine} {ex}")); _error = ex; } EnsureWriting(); }
public void Report(Scenario scenario) { try { var writer = new DelayedBatchWriter(_queue); writer.Write(new StartScenario(scenario.Title)); foreach (var given in scenario.GetGivens()) { writer.Write(given); } writer.Write(scenario.GetWhen()); foreach (var then in scenario.GetThens()) { writer.Write(then); } writer.Complete(); } catch (Exception ex) { _error = ex; } EnsureWriting(); }