Пример #1
0
 private static IEnumerable SourceMustBeStaticError()
 {
     var parms = new TestFixtureParameters();
     parms.RunState = RunState.NotRunnable;
     parms.Properties.Set(PropertyNames.SkipReason, MUST_BE_STATIC);
     return new TestFixtureParameters[] { parms };
 }
Пример #2
0
        /// <summary>
        /// Returns a set of ITestFixtureData items for use as arguments
        /// to a parameterized test fixture.
        /// </summary>
        /// <param name="sourceType">The type for which data is needed.</param>
        /// <returns></returns>
        public IEnumerable<ITestFixtureData> GetParametersFor(Type sourceType)
        {
            List<ITestFixtureData> data = new List<ITestFixtureData>();

            try
            {
                IEnumerable source = GetTestFixtureSource(sourceType);

                if (source != null)
                {
                    foreach (object item in source)
                    {
                        var parms = item as ITestFixtureData;

                        if (parms == null)
                        {
                            object[] args = item as object[];
                            if (args == null)
                            {
                                args = new object[] { item };
                            }

                            parms = new TestFixtureParameters(args);
                        }

                        if (this.Category != null)
                            foreach (string cat in this.Category.Split(new char[] { ',' }))
                                parms.Properties.Add(PropertyNames.Category, cat);

                        data.Add(parms);
                    }
                }
            }
            catch (Exception ex)
            {
                data.Clear();
                data.Add(new TestFixtureParameters(ex));
            }

            return data;
        }