private void CustomizeFixtureByParameter(IParameterInfo parameter)
        {
            var customizeAttributes = parameter.GetCustomAttributes <CustomizeAttribute>(false);

            foreach (var ca in customizeAttributes)
            {
                var customization = ca.GetCustomization(parameter.ParameterInfo);
                this._fixture.Customize(customization);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Return an IEnumerable providing data for use with the
        /// supplied parameter.
        /// </summary>
        /// <param name="parameter">An IParameterInfo representing one
        /// argument to a parameterized test</param>
        /// <returns>
        /// An IEnumerable providing the required data
        /// </returns>
        public IEnumerable GetDataFor(IParameterInfo parameter)
        {
            var data = new List<object>();

            foreach (IParameterDataSource source in parameter.GetCustomAttributes<IParameterDataSource>(false))
            {
                foreach (object item in source.GetData(parameter))
                    data.Add(item);
            }

            return data;
        }
        /// <summary>
        /// Return an IEnumerable providing data for use with the
        /// supplied parameter.
        /// </summary>
        /// <param name="parameter">An IParameterInfo representing one
        /// argument to a parameterized test</param>
        /// <returns>
        /// An IEnumerable providing the required data
        /// </returns>
        public IEnumerable GetDataFor(IParameterInfo parameter)
        {
            var data = new List <object>();

            foreach (IParameterDataSource source in parameter.GetCustomAttributes <IParameterDataSource>(false))
            {
                foreach (object item in source.GetData(parameter))
                {
                    data.Add(item);
                }
            }

            return(data);
        }
 private void CustomizeFixtureByParameter(IParameterInfo parameter)
 {
     var customizeAttributes = parameter.GetCustomAttributes<CustomizeAttribute>(false);
     foreach (var ca in customizeAttributes)
     {
         var customization = ca.GetCustomization(parameter.ParameterInfo);
         this._fixture.Customize(customization);
     }
 }