private Test BuildSingleFixture(Type type, TestFixtureAttribute attr)
 {
     object[] array = null;
     if (attr != null)
     {
         array = attr.Arguments;
         if (type.ContainsGenericParameters)
         {
             Type[] typeArgsOut = attr.TypeArgs;
             if (typeArgsOut.Length > 0 || TypeHelper.CanDeduceTypeArgsFromArgs(type, array, ref typeArgsOut))
             {
                 type = TypeHelper.MakeGenericType(type, typeArgsOut);
             }
         }
     }
     fixture = new TestFixture(type, array);
     CheckTestFixtureIsValid(fixture);
     fixture.ApplyCommonAttributes(type);
     if (fixture.RunState == RunState.Runnable && attr != null && attr.Ignore)
     {
         fixture.RunState = RunState.Ignored;
         fixture.Properties.Set(PropertyNames.SkipReason, attr.IgnoreReason);
     }
     AddTestCases(type);
     return(fixture);
 }
Exemple #2
0
        private Test BuildSingleFixture(Type type, TestFixtureAttribute attr)
        {
            object[] arguments = null;

            if (attr != null)
            {
                arguments = (object[])attr.Arguments;

#if CLR_2_0 || CLR_4_0
                if (type.ContainsGenericParameters)
                {
                    Type[] typeArgs = (Type[])attr.TypeArgs;
                    if (typeArgs.Length > 0 ||
                        TypeHelper.CanDeduceTypeArgsFromArgs(type, arguments, ref typeArgs))
                    {
                        type = TypeHelper.MakeGenericType(type, typeArgs);
                    }
                }
#endif
            }

            this.fixture = new TestFixture(type, arguments);
            CheckTestFixtureIsValid(fixture);

            fixture.ApplyCommonAttributes(type);

            if (fixture.RunState == RunState.Runnable && attr != null)
            {
                if (attr.Ignore)
                {
                    fixture.RunState = RunState.Ignored;
                    fixture.Properties.Set(PropertyNames.SkipReason, attr.IgnoreReason);
                }
            }

            AddTestCases(type);

            return(this.fixture);
        }