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