Exemplo n.º 1
0
        public TestSuite BuildFrom(ITypeInfo typeInfo, IPreFilter filter)
        {
            var fixture = new TestFixture(typeInfo);

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(new AttributeProviderWrapper <FixtureLifeCycleAttribute>(typeInfo.Type.GetTypeInfo().Assembly));
            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture, filter);

            return(fixture);
        }
Exemplo n.º 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);
#if PORTABLE
            fixture.ApplyAttributesToTest(type.AsCustomAttributeProvider());
#else
            fixture.ApplyAttributesToTest(type);
#endif

            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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Build a TestFixture from type provided. A non-null TestSuite
        /// must always be returned, since the method is generally called
        /// because the user has marked the target class as a fixture.
        /// If something prevents the fixture from being used, it should
        /// be returned nonetheless, labelled as non-runnable.
        /// </summary>
        /// <param name="typeInfo">An ITypeInfo for the fixture to be used.</param>
        /// <returns>A TestSuite object or one derived from TestSuite.</returns>
        // TODO: This should really return a TestFixture, but that requires changes to the Test hierarchy.
        public TestSuite BuildFrom(ITypeInfo typeInfo)
        {
            var fixture = new TestFixture(typeInfo);

            if (fixture.RunState != RunState.NotRunnable)
                CheckTestFixtureIsValid(fixture);

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture);

            return fixture;
        }
        /// <summary>
        /// Build a TestFixture from type provided. A non-null TestSuite
        /// must always be returned, since the method is generally called
        /// because the user has marked the target class as a fixture.
        /// If something prevents the fixture from being used, it should
        /// be returned nonetheless, labelled as non-runnable.
        /// </summary>
        /// <param name="type">The type of the fixture to be used.</param>
        /// <returns>A TestSuite object or one derived from TestSuite.</returns>
        // TODO: This should really return a TestFixture, but that requires changes to the Test hierarchy.
        public TestSuite BuildFrom(Type type)
        {
            this.fixture = new TestFixture(type);

            if (fixture.RunState != RunState.NotRunnable)
                CheckTestFixtureIsValid(fixture);

            fixture.ApplyAttributesToTest(type);


            AddTestCases(type);

            return this.fixture;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Build a TestFixture from type provided. A non-null TestSuite
        /// must always be returned, since the method is generally called
        /// because the user has marked the target class as a fixture.
        /// If something prevents the fixture from being used, it should
        /// be returned nonetheless, labeled as non-runnable.
        /// </summary>
        /// <param name="typeInfo">An ITypeInfo for the fixture to be used.</param>
        /// <param name="filter">Filter used to select methods as tests.</param>
        /// <returns>A TestSuite object or one derived from TestSuite.</returns>
        // TODO: This should really return a TestFixture, but that requires changes to the Test hierarchy.
        public TestSuite BuildFrom(ITypeInfo typeInfo, IPreFilter filter)
        {
            var fixture = new TestFixture(typeInfo);

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture, filter);

            return(fixture);
        }
        /// <summary>
        /// Build a TestFixture from type provided. A non-null TestSuite
        /// must always be returned, since the method is generally called
        /// because the user has marked the target class as a fixture.
        /// If something prevents the fixture from being used, it should
        /// be returned nonetheless, labelled as non-runnable.
        /// </summary>
        /// <param name="type">The type of the fixture to be used.</param>
        /// <returns>A TestSuite object or one derived from TestSuite.</returns>
        // TODO: This should really return a TestFixture, but that requires changes to the Test hierarchy.
        public TestSuite BuildFrom(Type type)
        {
            this.fixture = new TestFixture(type);

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(type);


            AddTestCases(type);

            return(this.fixture);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Build a TestFixture from type provided. A non-null TestSuite
        /// must always be returned, since the method is generally called
        /// because the user has marked the target class as a fixture.
        /// If something prevents the fixture from being used, it should
        /// be returned nonetheless, labelled as non-runnable.
        /// </summary>
        /// <param name="typeInfo">An ITypeInfo for the fixture to be used.</param>
        /// <param name="filter">Filter used to select methods as tests.</param>
        /// <returns>A TestSuite object or one derived from TestSuite.</returns>
        // TODO: This should really return a TestFixture, but that requires changes to the Test hierarchy.
        public TestSuite BuildFrom(ITypeInfo typeInfo, IPreFilter filter)
        {
            // Build our custom SetUpFixture to get the NUnit runner to initialize us
            // even though we don't own the test assembly.
            var setUpFixture = _setUpFixtureBuilder.BuildFrom(typeInfo);
            var fixture      = new TestFixture(typeInfo);

            SetUpRandomizedContext(setUpFixture, fixture);

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture, filter);

            setUpFixture.Add(fixture);
            return(setUpFixture);
        }
Exemplo n.º 8
0
        private TestFixture BuildSingleFixture(Type type, TestFixtureAttribute attr)
        {
            object[] arguments = null;

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

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

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

            _fixture.ApplyAttributesToTest(type);

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

            AddTestCases(type);

            return(this._fixture);
        }
        /// <summary>
        /// Overload of BuildFrom called by TestFixtureAttribute. Builds
        /// a fixture using the provided type and information in the
        /// properties of the attribute.
        /// </summary>
        /// <param name="type">The Type for which to construct a fixture.</param>
        /// <param name="attr">The attribute marking the fixture Type.</param>
        /// <returns></returns>
        public TestSuite BuildFrom(Type type, TestFixtureAttribute attr)
        {
            object[] arguments = null;

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

#if !NETCF
                if (type.ContainsGenericParameters)
                {
                    Type[] typeArgs = attr.TypeArgs;
                    if (typeArgs.Length == 0)
                    {
                        int cnt = 0;
                        foreach (object o in arguments)
                        {
                            if (o is Type)
                            {
                                cnt++;
                            }
                            else
                            {
                                break;
                            }
                        }

                        typeArgs = new Type[cnt];
                        for (int i = 0; i < cnt; i++)
                        {
                            typeArgs[i] = (Type)arguments[i];
                        }

                        if (cnt > 0)
                        {
                            object[] args = new object[arguments.Length - cnt];
                            for (int i = 0; i < args.Length; i++)
                            {
                                args[i] = arguments[cnt + i];
                            }

                            arguments = args;
                        }
                    }

                    if (typeArgs.Length > 0 ||
                        TypeHelper.CanDeduceTypeArgsFromArgs(type, arguments, ref typeArgs))
                    {
                        type = TypeHelper.MakeGenericType(type, typeArgs);
                    }
                }
#endif
            }

            this.fixture = new TestFixture(type);

            if (arguments != null)
            {
                string name   = fixture.Name = TypeHelper.GetDisplayName(type, arguments);
                string nspace = type.Namespace;
                fixture.FullName = nspace != null && nspace != ""
                    ? nspace + "." + name
                    : name;
                fixture.Arguments = arguments;
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(type);

            AddTestCases(type);

            return(this.fixture);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Overload of BuildFrom called by tests that have arguments.
        /// Builds a fixture using the provided type and information
        /// in the ITestFixtureData object.
        /// </summary>
        /// <param name="typeInfo">The TypeInfo for which to construct a fixture.</param>
        /// <param name="filter">Filter used to select methods as tests.</param>
        /// <param name="testFixtureData">An object implementing ITestFixtureData or null.</param>
        /// <returns></returns>
        public TestSuite BuildFrom(ITypeInfo typeInfo, IPreFilter filter, ITestFixtureData testFixtureData)
        {
            Guard.ArgumentNotNull(testFixtureData, nameof(testFixtureData));

            object[] arguments = testFixtureData.Arguments;

            if (typeInfo.ContainsGenericParameters)
            {
                Type[] typeArgs = testFixtureData.TypeArgs;
                if (typeArgs == null || typeArgs.Length == 0)
                {
                    int cnt = 0;
                    foreach (object o in arguments)
                    {
                        if (o is Type)
                        {
                            cnt++;
                        }
                        else
                        {
                            break;
                        }
                    }

                    typeArgs = new Type[cnt];
                    for (int i = 0; i < cnt; i++)
                    {
                        typeArgs[i] = (Type)arguments[i];
                    }

                    if (cnt > 0)
                    {
                        object[] args = new object[arguments.Length - cnt];
                        for (int i = 0; i < args.Length; i++)
                        {
                            args[i] = arguments[cnt + i];
                        }

                        arguments = args;
                    }
                }

                if (typeArgs.Length > 0 ||
                    TypeHelper.CanDeduceTypeArgsFromArgs(typeInfo.Type, arguments, ref typeArgs))
                {
                    typeInfo = typeInfo.MakeGenericType(typeArgs);
                }
            }

            var fixture = new TestFixture(typeInfo, arguments);

            string name = fixture.Name;

            if (testFixtureData.TestName != null)
            {
                fixture.Name = testFixtureData.TestName;
            }
            else
            {
                var argDisplayNames = (testFixtureData as TestParameters)?.ArgDisplayNames;
                if (argDisplayNames != null)
                {
                    fixture.Name = typeInfo.GetDisplayName();
                    if (argDisplayNames.Length != 0)
                    {
                        fixture.Name += '(' + string.Join(", ", argDisplayNames) + ')';
                    }
                }
                else if (arguments != null && arguments.Length > 0)
                {
                    fixture.Name = typeInfo.GetDisplayName(arguments);
                }
            }

            if (fixture.Name != name) // name was changed
            {
                string nspace = typeInfo.Namespace;
                fixture.FullName = nspace != null && nspace != ""
                    ? nspace + "." + fixture.Name
                    : fixture.Name;
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                fixture.RunState = testFixtureData.RunState;
            }

            foreach (string key in testFixtureData.Properties.Keys)
            {
                foreach (object val in testFixtureData.Properties[key])
                {
                    fixture.Properties.Add(key, val);
                }
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture, filter);

            return(fixture);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Overload of BuildFrom called by tests that have arguments.
        /// Builds a fixture using the provided type and information
        /// in the ITestFixtureData object.
        /// </summary>
        /// <param name="typeInfo">The TypeInfo for which to construct a fixture.</param>
        /// <param name="filter">Filter used to select methods as tests.</param>
        /// <param name="testFixtureData">An object implementing ITestFixtureData or null.</param>
        /// <returns></returns>
        public TestSuite BuildFrom(ITypeInfo typeInfo, IPreFilter filter, ITestFixtureData testFixtureData)
        {
            //Guard.ArgumentNotNull(testFixtureData, nameof(testFixtureData));
            if (testFixtureData is null)
            {
                throw new ArgumentNullException(nameof(testFixtureData));
            }

            object[] arguments = testFixtureData.Arguments;

            if (typeInfo.ContainsGenericParameters)
            {
                Type[] typeArgs = testFixtureData.TypeArgs;
                if (typeArgs is null || typeArgs.Length == 0)
                {
                    int cnt = 0;
                    foreach (object o in arguments)
                    {
                        if (o is Type)
                        {
                            cnt++;
                        }
                        else
                        {
                            break;
                        }
                    }

                    typeArgs = new Type[cnt];
                    for (int i = 0; i < cnt; i++)
                    {
                        typeArgs[i] = (Type)arguments[i];
                    }

                    if (cnt > 0)
                    {
                        object[] args = new object[arguments.Length - cnt];
                        for (int i = 0; i < args.Length; i++)
                        {
                            args[i] = arguments[cnt + i];
                        }

                        arguments = args;
                    }
                }

                if (typeArgs.Length > 0 ||
                    TypeHelper.CanDeduceTypeArgsFromArgs(typeInfo.Type, arguments, ref typeArgs))
                {
                    typeInfo = typeInfo.MakeGenericType(typeArgs);
                }
            }

            // Build our custom SetUpFixture to get the NUnit runner to initialize us
            // even though we don't own the test assembly.
            var setUpFixture = _setUpFixtureBuilder.BuildFrom(typeInfo);
            var fixture      = new TestFixture(typeInfo, arguments);

            SetUpRandomizedContext(setUpFixture, fixture);

            string name = fixture.Name;

            if (testFixtureData.TestName != null)
            {
                fixture.Name = testFixtureData.TestName;
            }
            else
            {
                //var argDisplayNames = (testFixtureData as NUnit.Framework.Internal.TestParameters)?.ArgDisplayNames;
                var      testParameters  = testFixtureData as NUnit.Framework.Internal.TestParameters;
                string[] argDisplayNames = null;
                if (testParameters != null)
                {
                    // Hack so we can call the same internal field that NUnit does
                    BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
                    FieldInfo    field     = typeof(NUnit.Framework.Internal.TestParameters).GetField("_argDisplayNames", bindFlags);
                    argDisplayNames = (string[])field.GetValue(testFixtureData);
                }
                if (argDisplayNames != null)
                {
                    fixture.Name = typeInfo.GetDisplayName();
                    if (argDisplayNames.Length != 0)
                    {
                        fixture.Name += '(' + string.Join(", ", argDisplayNames) + ')';
                    }
                }
                else if (arguments != null && arguments.Length > 0)
                {
                    fixture.Name = typeInfo.GetDisplayName(arguments);
                }
            }

            if (fixture.Name != name) // name was changed
            {
                string nspace = typeInfo.Namespace;
                fixture.FullName = nspace != null && nspace != ""
                    ? nspace + "." + fixture.Name
                    : fixture.Name;
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                fixture.RunState = testFixtureData.RunState;
            }

            foreach (string key in testFixtureData.Properties.Keys)
            {
                foreach (object val in testFixtureData.Properties[key])
                {
                    fixture.Properties.Add(key, val);
                }
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture, filter);

            setUpFixture.Add(fixture);
            return(setUpFixture);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Overload of BuildFrom called by tests that have arguments.
        /// Builds a fixture using the provided type and information 
        /// in the ITestFixtureData object.
        /// </summary>
        /// <param name="typeInfo">The TypeInfo for which to construct a fixture.</param>
        /// <param name="testFixtureData">An object implementing ITestFixtureData or null.</param>
        /// <returns></returns>
        public TestSuite BuildFrom(ITypeInfo typeInfo, ITestFixtureData testFixtureData)
        {
            Guard.ArgumentNotNull(testFixtureData, "testFixtureData");

            object[] arguments = testFixtureData.Arguments;

            if (typeInfo.ContainsGenericParameters)
            {
                Type[] typeArgs = testFixtureData.TypeArgs;
                if (typeArgs.Length == 0)
                {
                    int cnt = 0;
                    foreach (object o in arguments)
                        if (o is Type) cnt++;
                        else break;

                    typeArgs = new Type[cnt];
                    for (int i = 0; i < cnt; i++)
                        typeArgs[i] = (Type)arguments[i];

                    if (cnt > 0)
                    {
                        object[] args = new object[arguments.Length - cnt];
                        for (int i = 0; i < args.Length; i++)
                            args[i] = arguments[cnt + i];

                        arguments = args;
                    }
                }

                if (typeArgs.Length > 0 ||
                    TypeHelper.CanDeduceTypeArgsFromArgs(typeInfo.Type, arguments, ref typeArgs))
                {
                    typeInfo = typeInfo.MakeGenericType(typeArgs);
                }
            }

            var fixture = new TestFixture(typeInfo);
            
            if (arguments != null && arguments.Length > 0)
            {
                string name = fixture.Name = typeInfo.GetDisplayName(arguments);
                string nspace = typeInfo.Namespace;
                fixture.FullName = nspace != null && nspace != ""
                    ? nspace + "." + name
                    : name;
                fixture.Arguments = arguments;
            }

            if (fixture.RunState != RunState.NotRunnable)
                fixture.RunState = testFixtureData.RunState;

            foreach (string key in testFixtureData.Properties.Keys)
                foreach (object val in testFixtureData.Properties[key])
                    fixture.Properties.Add(key, val);

            if (fixture.RunState != RunState.NotRunnable)
                CheckTestFixtureIsValid(fixture);

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            AddTestCasesToFixture(fixture);

            return fixture;
        }
        /// <summary>
        /// Overload of BuildFrom called by TestFixtureAttribute. Builds
        /// a fixture using the provided type and information in the
        /// properties of the attribute.
        /// </summary>
        /// <param name="type">The Type for which to construct a fixture.</param>
        /// <param name="attr">The attribute marking the fixture Type.</param>
        /// <returns></returns>
        public TestSuite BuildFrom(Type type, TestFixtureAttribute attr)
        {
            object[] arguments = null;

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

#if !NETCF
                if (type.ContainsGenericParameters)
                {
                    Type[] typeArgs = attr.TypeArgs;
                    if (typeArgs.Length == 0)
                    {
                        int cnt = 0;
                        foreach (object o in arguments)
                            if (o is Type) cnt++;
                            else break;

                        typeArgs = new Type[cnt];
                        for (int i = 0; i < cnt; i++)
                            typeArgs[i] = (Type)arguments[i];

                        if (cnt > 0)
                        {
                            object[] args = new object[arguments.Length - cnt];
                            for (int i = 0; i < args.Length; i++)
                                args[i] = arguments[cnt + i];

                            arguments = args;
                        }
                    }

                    if (typeArgs.Length > 0 ||
                        TypeHelper.CanDeduceTypeArgsFromArgs(type, arguments, ref typeArgs))
                    {
                        type = TypeHelper.MakeGenericType(type, typeArgs);
                    }
                }
#endif
            }

            this.fixture = new TestFixture(type);
            
            if (arguments != null)
            {
                string name = fixture.Name = TypeHelper.GetDisplayName(type, arguments);
                string nspace = type.Namespace;
                fixture.FullName = nspace != null && nspace != ""
                    ? nspace + "." + name
                    : name;
                fixture.Arguments = arguments;
            }

            if (fixture.RunState != RunState.NotRunnable)
                CheckTestFixtureIsValid(fixture);

            fixture.ApplyAttributesToTest(type);

            AddTestCases(type);

            return this.fixture;
        }
Exemplo n.º 14
0
        /// <summary>
        /// Overload of BuildFrom called by tests that have arguments.
        /// Builds a fixture using the provided type and information
        /// in the ITestFixtureData object.
        /// </summary>
        /// <param name="type">The Type for which to construct a fixture.</param>
        /// <param name="testFixtureData">An object implementing ITestFixtureData or null.</param>
        /// <returns></returns>
        public TestSuite BuildFrom(Type type, ITestFixtureData testFixtureData)
        {
            Guard.ArgumentNotNull(testFixtureData, "testFixtureData");

            object[] arguments = testFixtureData.Arguments;

            if (type.ContainsGenericParameters)
            {
                Type[] typeArgs = testFixtureData.TypeArgs;
                if (typeArgs.Length == 0)
                {
                    int cnt = 0;
                    foreach (object o in arguments)
                    {
                        if (o is Type)
                        {
                            cnt++;
                        }
                        else
                        {
                            break;
                        }
                    }

                    typeArgs = new Type[cnt];
                    for (int i = 0; i < cnt; i++)
                    {
                        typeArgs[i] = (Type)arguments[i];
                    }

                    if (cnt > 0)
                    {
                        object[] args = new object[arguments.Length - cnt];
                        for (int i = 0; i < args.Length; i++)
                        {
                            args[i] = arguments[cnt + i];
                        }

                        arguments = args;
                    }
                }

                if (typeArgs.Length > 0 ||
                    TypeHelper.CanDeduceTypeArgsFromArgs(type, arguments, ref typeArgs))
                {
                    type = TypeHelper.MakeGenericType(type, typeArgs);
                }
            }

            var fixture = new TestFixture(type);

            if (arguments != null && arguments.Length > 0)
            {
                string name   = fixture.Name = TypeHelper.GetDisplayName(type, arguments);
                string nspace = type.Namespace;
                fixture.FullName = nspace != null && nspace != ""
                    ? nspace + "." + name
                    : name;
                fixture.Arguments = arguments;
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                fixture.RunState = testFixtureData.RunState;
            }

            foreach (string key in testFixtureData.Properties.Keys)
            {
                foreach (object val in testFixtureData.Properties[key])
                {
                    fixture.Properties.Add(key, val);
                }
            }

            if (fixture.RunState != RunState.NotRunnable)
            {
                CheckTestFixtureIsValid(fixture);
            }

            fixture.ApplyAttributesToTest(type);

            AddTestCasesToFixture(fixture);

            return(fixture);
        }
Exemplo n.º 15
0
        private Test BuildSingleFixture(Type type, TestFixtureAttribute attr)
        {
            object[] arguments = null;

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

#if !NETCF
                if (type.ContainsGenericParameters)
                {
                    Type[] typeArgs = attr.TypeArgs;
                    if (typeArgs.Length == 0)
                    {
                        int cnt = 0;
                        foreach (object o in arguments)
                        {
                            if (o is Type)
                            {
                                cnt++;
                            }
                            else
                            {
                                break;
                            }
                        }

                        typeArgs = new Type[cnt];
                        for (int i = 0; i < cnt; i++)
                        {
                            typeArgs[i] = (Type)arguments[i];
                        }

                        if (cnt > 0)
                        {
                            object[] args = new object[arguments.Length - cnt];
                            for (int i = 0; i < args.Length; i++)
                            {
                                args[i] = arguments[cnt + i];
                            }

                            arguments = args;
                        }
                    }

                    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.ApplyAttributesToTest(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);
        }