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 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);
     }
 }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        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);
            }
        }