Exemple #1
0
        public void Write(ExampleBase example, int level)
        {
            var result = example.Failed()
                ? new TestResultDTO { Outcome = TestOutcome.Failed, StackTrace = example.Exception.StackTrace, Message = example.Exception.Message }
                : new TestResultDTO { Outcome = example.Pending ? TestOutcome.Skipped : TestOutcome.Passed };
            result.TestName = example.FullName();
            result.Source = this.Source;

            this.observer.Receive(result);
        }
 public string WriteFailure(ExampleBase example)
 {
     var failure = "\n" + example.FullName().Replace("_", " ") + "\n";
     failure += example.Exception.CleanMessage() + "\n";
     var stackTrace = FailureLines(example.Exception);
     stackTrace.AddRange(FailureLines(example.Exception.InnerException));
     var flattenedStackTrace = stackTrace.Flatten("\n").TrimEnd() + "\n";
     failure += example.Context.GetInstance().StackTraceToPrint(flattenedStackTrace);
     return failure;
 }