Пример #1
0
        public void Create(Type t, FixtureCollection fixtures)
        {
            // get framework
            IFramework framework = FrameworkFactory.FromType(t);

            if (framework == null)
            {
                return;
            }

            // get test attribute
            Object fixtureAttribute = TypeHelper.TryGetFirstCustomAttribute(t, framework.TestFixtureAttributeType);

            if (fixtureAttribute == null)
            {
                return;
            }

            // create run
            bool       ignored  = TypeHelper.HasCustomAttribute(t, framework.IgnoreAttributeType);
            MethodInfo setUp    = TypeHelper.GetAttributedMethod(t, framework.TestFixtureSetUpAttributeType);
            MethodInfo tearDown = TypeHelper.GetAttributedMethod(t, framework.TestFixtureTearDownAttributeType);

            Fixture fixture = new Fixture(t, this.CreateRun(framework), setUp, tearDown, ignored);

            fixtures.Add(fixture);
        }
Пример #2
0
        public void Create(Type t, FixtureCollection fixtures)
        {
            MethodInfo mi = this.GetMain(t, new Type[] { typeof(string[]) });

            if (mi == null)
            {
                mi = this.GetMain(t, Type.EmptyTypes);
            }
            if (mi == null)
            {
                return;
            }

            // create run
            SSCLIRun run     = new SSCLIRun(mi, this.successReturnCode);
            Fixture  fixture = new Fixture(t, run, null, null, false);

            fixtures.Add(fixture);
        }
Пример #3
0
        public void Create(Type t, FixtureCollection fixtures)
        {
            if (!t.IsClass)
            {
                return;
            }
            if (t.IsAbstract)
            {
                return;
            }
            if (!t.Name.EndsWith(this.fixtureNameSuffix))
            {
                return;
            }


            MethodInfo setup    = t.GetMethod(this.testFixtureSetUpName, Type.EmptyTypes);
            MethodInfo tearDown = t.GetMethod(this.testFixtureTearDownName, Type.EmptyTypes);

            Fixture fixture = new Fixture(t, this.run, setup, tearDown, false);

            fixtures.Add(fixture);
        }
Пример #4
0
        public void Create(Type t, FixtureCollection fixtures)
        {
            MethodInfo setUp            = null;
            MethodInfo tearDown         = null;
            bool       setUpSearched    = false;
            bool       tearDownSearched = false;

            bool ignored = TypeHelper.HasCustomAttribute(t, typeof(IgnoreAttribute));

            foreach (TestFixturePatternAttribute attr in t.GetCustomAttributes(typeof(TestFixturePatternAttribute), true))
            {
                IRun run = null;
                try
                {
                    run = attr.GetRun();
                }
                catch (Exception ex)
                {
                    run = new FixtureFailedLoadingRun(t, ex);
                }
                if (!setUpSearched)
                {
                    setUp         = TypeHelper.GetAttributedMethod(t, typeof(TestFixtureSetUpAttribute));
                    setUpSearched = true;
                }
                if (!tearDownSearched)
                {
                    tearDown         = TypeHelper.GetAttributedMethod(t, typeof(TestFixtureTearDownAttribute));
                    tearDownSearched = true;
                }

                Fixture fixture = new Fixture(t, run, setUp, tearDown, ignored);
                fixture.TimeOut        = attr.GetTimeOut();
                fixture.ApartmentState = attr.ApartmentState;
                fixtures.Add(fixture);
            }
        }