/// <summary>
        /// Return an IEnumerable providing test cases for use in
        /// running a parameterized test.
        /// </summary>
        /// <param name="method"></param>
        /// <returns></returns>
        public IEnumerable GetTestCasesFor(MethodInfo method, Test parentSuite)
        {
            ArrayList parameterList = new ArrayList();

            foreach (ProviderReference providerReference in GetSourcesFor(method, parentSuite))
            {
                foreach (object source in providerReference.GetInstance())
                {
                    ParameterSet parms;

                    if (source == null)
                    {
                        parms           = new ParameterSet();
                        parms.Arguments = new object[] { null };
                    }
                    else
                    {
                        parms = source as ParameterSet;
                    }

                    if (parms == null)
                    {
                        Type sourceType = source.GetType();

                        if (sourceType.GetInterface("NUnit.Framework.ITestCaseData") != null ||
                            sourceType.GetInterface("NUnit.Framework.Api.ITestCaseData") != null)
                        {
                            parms = ParameterSet.FromDataSource(source);
                        }
                        else
                        {
                            parms = new ParameterSet();

                            ParameterInfo[] parameters = method.GetParameters();

                            if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(sourceType))
                            {
                                parms.Arguments = new object[] { source }
                            }
                            ;
                            else if (source is object[])
                            {
                                parms.Arguments = (object[])source;
                            }
                            else if (source is Array)
                            {
                                Array array = (Array)source;
                                if (array.Rank == 1)
                                {
                                    parms.Arguments = new object[array.Length];
                                    for (int i = 0; i < array.Length; i++)
                                    {
                                        parms.Arguments[i] = (object)array.GetValue(i);
                                    }
                                }
                            }
                            else
                            {
                                parms.Arguments = new object[] { source }
                            };
                        }
                    }


                    // This is the only point we can easily check the individual returned
                    // ParameterSet items from a TestCaseSourceAttribute.
                    if (parms.ExpectedExceptionName != null)
                    {
                        Compatibility.Error(providerReference.ProviderLocation,
                                            "TestCaseSourceAttribute does not support ExpectedException in NUnit 3. Use Assert.Throws or ThrowsConstraint.");
                    }
                    if (parms.RunState == RunState.Ignored && string.IsNullOrEmpty(parms.IgnoreReason))
                    {
                        Compatibility.Error(providerReference.ProviderLocation,
                                            "TestCaseSourceAttribute requires a reason when case is ignored in NUnit 3.");
                    }

                    if (providerReference.ProviderCategory != null)
                    {
                        foreach (string cat in providerReference.ProviderCategory.Split(new char[] { ',' }))
                        {
                            parms.Categories.Add(cat);
                        }
                    }

                    parameterList.Add(parms);
                }
            }

            return(parameterList);
        }