コード例 #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
        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);
                }
            }
        }