Ejemplo n.º 1
0
        public void Initialize()
        {
            _decorators = new List <TestDecorator>();

            MethodInfo testMethod = GetType().GetMethod(_context.TestName);
            var        attributes = testMethod
                                    .GetCustomAttributes(typeof(TestAttributeBase), false)
                                    .OfType <TestAttributeBase>()
                                    .OrderBy <TestAttributeBase, int>(a => a.Priority);

            foreach (TestAttributeBase attribute in attributes)
            {
                attribute.SetMethodInfo(testMethod);
                attribute.TestClassInstance = this;
                TestDecorator decorator = attribute.GetTestDecorator();
                decorator.BeforeTestRun();
                _decorators.Add(decorator);
            }

            OnInitialize();
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            _decorators = new List <TestDecorator>();

            MethodInfo testMethod = this.GetType().GetMethod(_context.TestName);

            object[] attributes = testMethod.GetCustomAttributes(false);
            foreach (Attribute attribute in attributes)
            {
                if (attribute is TestAttributeBase)
                {
                    TestAttributeBase testAttrib = attribute as TestAttributeBase;
                    testAttrib.SetMethodInfo(testMethod);
                    testAttrib.TestClassInstance = this;
                    TestDecorator decorator = testAttrib.GetTestDecorator();
                    decorator.BeforeTestRun();
                    _decorators.Add(decorator);
                }
            }

            OnInitialize();
        }