Ejemplo n.º 1
0
        private void PopulateTestFixture(Test fixtureTest, ITypeInfo type, TestFixtureAttribute2 fixtureAttrib)
        {
            IMethodInfo setUpMethod    = GetMethodWithAttribute <SetUpAttribute2>(type);
            IMethodInfo tearDownMethod = GetMethodWithAttribute <TearDownAttribute2>(type);

            string namePrefix = setUpMethod != null ? setUpMethod.Name + @"." : string.Empty;
            string nameSuffix = tearDownMethod != null ? @"." + tearDownMethod.Name : string.Empty;

            foreach (IMethodInfo method in type.GetMethods(BindingFlags.Instance | BindingFlags.Public))
            {
                BuildTestsFromMethod(fixtureTest, method, namePrefix, nameSuffix);
            }
        }
Ejemplo n.º 2
0
        private void BuildTestFixtureFromPatternAttribute(Test parent, ITypeInfo type, TestFixturePatternAttribute2 attrib)
        {
            Test fixtureTest = new Test(type.Name, type);

            fixtureTest.Kind = TestKinds.Fixture;

            MbUnit2MetadataUtils.PopulateFixtureMetadata(fixtureTest, type);

            TestFixtureAttribute2 fixtureAttrib = attrib as TestFixtureAttribute2;

            if (fixtureAttrib != null)
            {
                PopulateTestFixture(fixtureTest, type, fixtureAttrib);
            }
            else
            {
                ThrowUnsupportedAttribute(attrib);
            }

            parent.AddChild(fixtureTest);
        }