public void ReportFailure(string message, Exception exception) { string completeMessage = $"Unexpected {message}"; string completeMessageWithException = VerificationUtils.AppendExceptionToFailureMessage(completeMessage, exception); string stackTrace = VerificationUtils.BuildStackTraceForAggregateAssertion(); AtataContext context = AtataContext.Current; if (context != null) { context.AssertionResults.Add(AssertionResult.ForWarning(completeMessageWithException, stackTrace)); context.Log.Warn(completeMessageWithException); context.WarningReportStrategy.Report(completeMessageWithException, stackTrace); } else { throw new InvalidOperationException( $"Cannot report warning to {nameof(AtataContext)}.{nameof(AtataContext.Current)} as current context is null.", VerificationUtils.CreateAssertionException(completeMessage, exception)); } }
public void ReportFailure(string message, Exception exception) { string completeMessage = $"Wrong {message}"; string completeMessageWithException = VerificationUtils.AppendExceptionToFailureMessage(completeMessage, exception); string stackTrace = VerificationUtils.BuildStackTraceForAggregateAssertion(); AtataContext context = AtataContext.Current; if (context != null) { context.AssertionResults.Add(AssertionResult.ForFailure(completeMessageWithException, stackTrace)); if (context.AggregateAssertionLevel > 0) { context.Log.Error(completeMessage); context.AggregateAssertionStrategy.ReportFailure(completeMessageWithException, stackTrace); return; } } throw VerificationUtils.CreateAssertionException(completeMessage, exception); }
public void ReportFailure(string message, string stackTrace) { AtataContext.Current.PendingFailureAssertionResults.Add(AssertionResult.ForFailure(message, stackTrace)); }