Example #1
0
        public override void Reflect(
            RunInvokerTree tree,
            RunInvokerVertex parent,
            Type t)
        {
            foreach (MethodInfo method in TypeHelper.GetAttributedMethods(t, typeof(RowTestAttribute)))
            {
                try
                {
                    foreach (RowAttribute row in method.GetCustomAttributes(typeof(RowAttribute), true))
                    {
                        // get invoker
                        IRunInvoker invoker = new RowMethodRunInvoker(
                        this,
                            method,
                            row
                            );
                        if (row.ExpectedException != null)
                        {
                            invoker = new ExpectedExceptionRunInvoker(
                                invoker, row.ExpectedException, row.Description
                                    );
                        }
                        // decore invoker
                        invoker = DecoratorPatternAttribute.DecoreInvoker(method, invoker);

                        tree.AddChild(parent, invoker);
                    }
                }
                catch (Exception ex)
                {
                    MethodFailedLoadingRunInvoker invoker = new MethodFailedLoadingRunInvoker(this, ex, method);
                    tree.AddChild(parent, invoker);
                }
            }
        }
 protected ExpectedExceptionRunInvoker ExecuteInvoker(Type expectedType, Exception ex)
 {
     ThrowExceptionRunInvoker invoker = new ThrowExceptionRunInvoker(ex);
     ExpectedExceptionRunInvoker einvoker =
         new ExpectedExceptionRunInvoker(invoker, expectedType,description);
     ArrayList list = new ArrayList();
     einvoker.Execute(null, list);
     Assert.IsTrue(invoker.Invoked);
     return einvoker;
 }
 public void InvokerNull()
 {
     ExpectedExceptionRunInvoker einvoker =
         new ExpectedExceptionRunInvoker(null, typeof(Exception),description);
 }
 public void ExceptionTypeNull()
 {
     ExpectedExceptionRunInvoker einvoker =
         new ExpectedExceptionRunInvoker(new ThrowExceptionRunInvoker(null)
             , null, description);
 }