Пример #1
0
        public SetUpFixture(Type type) : base(type)
        {
            this.TestName.Name = type.Namespace;
            if (this.TestName.Name == null)
            {
                this.TestName.Name = "[default namespace]";
            }
            int index = TestName.Name.LastIndexOf('.');

            if (index > 0)
            {
                this.TestName.Name = this.TestName.Name.Substring(index + 1);
            }

            var fixtureSetUpMethods = new List <MethodInfo>();

            fixtureSetUpMethods.AddRange(Reflect.GetMethodsWithAttribute(type, NUnitFramework.SetUpAttribute, true));
            fixtureSetUpMethods.AddRange(Reflect.GetMethodsWithAttribute(type, NUnitFramework.OneTimeSetUpAttribute, true));
            FixtureSetUpMethods = fixtureSetUpMethods;

            var fixtureTearDownMethods = new List <MethodInfo>();

            fixtureTearDownMethods.AddRange(Reflect.GetMethodsWithAttribute(type, NUnitFramework.TearDownAttribute, true));
            fixtureTearDownMethods.AddRange(Reflect.GetMethodsWithAttribute(type, NUnitFramework.OneTimeTearDownAttribute, true));
            FixtureTearDownMethods = fixtureTearDownMethods;

#if CLR_2_0 || CLR_4_0
            this.actions = ActionsHelper.GetActionsFromTypesAttributes(type);
#endif
        }
Пример #2
0
        public NUnitTestFixture(Type fixtureType, object[] arguments)
            : base(fixtureType, arguments)
        {
            this.fixtureSetUpMethods =
                Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.FixtureSetUpAttribute, true);
            this.fixtureTearDownMethods =
                Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.FixtureTearDownAttribute, true);
            this.setUpMethods =
                Reflect.GetMethodsWithAttribute(this.FixtureType, NUnitFramework.SetUpAttribute, true);
            this.tearDownMethods =
                Reflect.GetMethodsWithAttribute(this.FixtureType, NUnitFramework.TearDownAttribute, true);

#if CLR_2_0 || CLR_4_0
            this.actions = ActionsHelper.GetActionsFromTypesAttributes(fixtureType);
#endif
        }
        public NUnitTestFixture(Type fixtureType, object[] arguments)
            : base(fixtureType, arguments)
        {
            var fixtureSetUpMethods = new List <MethodInfo>();

            fixtureSetUpMethods.AddRange(Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.TestFixtureSetUpAttribute, true));
            fixtureSetUpMethods.AddRange(Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.OneTimeSetUpAttribute, true));
            FixtureSetUpMethods = fixtureSetUpMethods;

            var fixtureTearDownMethods = new List <MethodInfo>();

            fixtureTearDownMethods.AddRange(Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.TestFixtureTearDownAttribute, true));
            fixtureTearDownMethods.AddRange(Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.OneTimeTearDownAttribute, true));
            FixtureTearDownMethods = fixtureTearDownMethods;

            SetUpMethods =
                Reflect.GetMethodsWithAttribute(this.FixtureType, NUnitFramework.SetUpAttribute, true);
            TearDownMethods =
                Reflect.GetMethodsWithAttribute(this.FixtureType, NUnitFramework.TearDownAttribute, true);

#if CLR_2_0 || CLR_4_0
            this.actions = ActionsHelper.GetActionsFromTypesAttributes(fixtureType);
#endif
        }