public override void Execute(object instance, CaseExecution caseExecution) { try { throw new ArgumentException("This parameterized test could not be executed, because no input values were available."); } catch (Exception exception) { caseExecution.Fail(exception); } }
public virtual void Execute(object instance, CaseExecution caseExecution) { try { bool isDeclaredAsync = Method.IsAsync(); if (isDeclaredAsync && Method.IsVoid()) { ThrowForUnsupportedAsyncVoid(); } object result; try { result = Method.Invoke(instance, parameters); } catch (TargetInvocationException exception) { throw new PreservedException(exception.InnerException); } if (isDeclaredAsync) { var task = (Task)result; try { task.Wait(); } catch (AggregateException exception) { throw new PreservedException(exception.InnerExceptions.First()); } } } catch (Exception exception) { caseExecution.Fail(exception); } }
public virtual void Execute(object instance, CaseExecution caseExecution) { try { bool isDeclaredAsync = Method.IsAsync(); if (isDeclaredAsync && Method.IsVoid()) ThrowForUnsupportedAsyncVoid(); object result; try { result = Method.Invoke(instance, parameters); } catch (TargetInvocationException exception) { throw new PreservedException(exception.InnerException); } if (isDeclaredAsync) { var task = (Task)result; try { task.Wait(); } catch (AggregateException exception) { throw new PreservedException(exception.InnerExceptions.First()); } } } catch (Exception exception) { caseExecution.Fail(exception); } }