コード例 #1
0
ファイル: RowRun.cs プロジェクト: BackupTheBerlios/mbunit-svn
        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);
                }
            }
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 public void InvokerNull()
 {
     ExpectedExceptionRunInvoker einvoker =
         new ExpectedExceptionRunInvoker(null, typeof(Exception),description);
 }
コード例 #4
0
 public void ExceptionTypeNull()
 {
     ExpectedExceptionRunInvoker einvoker =
         new ExpectedExceptionRunInvoker(new ThrowExceptionRunInvoker(null)
             , null, description);
 }