internal static Exception ApplyFlags(Exception ex, RecordExceptionFlags flags) { if (flags.HasFlag(RecordExceptionFlags.UnwindTargetExceptions)) { ex = UnwindTargetException(ex); } if (ex is AssertException && flags.HasFlag(RecordExceptionFlags.StrictVerification)) { throw SpecFailure.CannotAssertAssertExceptions(); } return(ex); }
public static Exception Exception(Action action, RecordExceptionFlags flags) { try { SyncContextImpl.Run(action); return(null); } catch (Exception ex) { if (ex is AssertException && flags.HasFlag(RecordExceptionFlags.IgnoreAssertExceptions)) { throw; } return(ApplyFlags(ex, flags)); } }
public static TestCodeDispatchInfo DispatchInfo(Action action, RecordExceptionFlags flags) { return(new TestCodeDispatchInfo( Exception(action, flags) )); }
public TestCodeDispatchInfo DispatchInfo(Action func, RecordExceptionFlags flags) { return(Carbonfrost.Commons.Spec.Record.DispatchInfo(() => func(), flags)); }
public ThrowsMatcher WithFlags(RecordExceptionFlags flags) { return(new ThrowsMatcher(Expected, flags)); }
private ThrowsMatcher(Type expected, RecordExceptionFlags flags) { Expected = expected ?? typeof(Exception); _flags = flags; }