Example #1
0
        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);
        }
Example #2
0
 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));
     }
 }
Example #3
0
 public static TestCodeDispatchInfo DispatchInfo(Action action, RecordExceptionFlags flags)
 {
     return(new TestCodeDispatchInfo(
                Exception(action, flags)
                ));
 }
Example #4
0
 public TestCodeDispatchInfo DispatchInfo(Action func, RecordExceptionFlags flags)
 {
     return(Carbonfrost.Commons.Spec.Record.DispatchInfo(() => func(), flags));
 }
Example #5
0
 public ThrowsMatcher WithFlags(RecordExceptionFlags flags)
 {
     return(new ThrowsMatcher(Expected, flags));
 }
Example #6
0
 private ThrowsMatcher(Type expected, RecordExceptionFlags flags)
 {
     Expected = expected ?? typeof(Exception);
     _flags   = flags;
 }