/// <summary>
 /// Initializes a new instance of the <see cref="InlineNullRegisterAutoDataAttribute"/> class.
 /// </summary>
 /// <param name="autoDataAttribute">The <see cref="AutoDataAttribute"/> instance that provides auto-generated data specimens.</param>
 /// <param name="parameterName">Name of the null parameter.</param>
 public InlineNullRegisterAutoDataAttribute(
     AutoDataAttribute autoDataAttribute,
     string parameterName)
     : base(autoDataAttribute)
 {
     _parameterName = parameterName;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="InlineAutoDataAndCustomizationsAttribute"/> class.
        /// </summary>
        /// <param name="autoDataAttribute">The <see cref="AutoDataAttribute"/> instance that provides auto-generated data specimens.</param>
        /// <param name="valuesAndCustomizationTypes">An array of inline values and customization types to be applied.</param>
        public InlineAutoDataAndCustomizationsAttribute(
            AutoDataAttribute autoDataAttribute,
            params object[] valuesAndCustomizationTypes)
            : base(
                autoDataAttribute,
                values: valuesAndCustomizationTypes.Where(x => !IsCustomizationType(x)).ToArray())
        {
            var customizations = valuesAndCustomizationTypes
                .Select(x => ToCustomizationTypeOrDefault(x))
                .Where(ct => ct != null)
                .Select(ct => (ICustomization)Activator.CreateInstance(ct, null));

            foreach (var c in customizations)
            {
                this.AutoDataAttribute.Fixture.Customize(c);
            }
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InlineAutoDataAttribute"/> class.
 /// </summary>
 /// <param name="autoDataAttribute">An <see cref="AutoDataAttribute"/>.</param>
 /// <param name="values">The data values to pass to the theory.</param>
 public InlineAutoDataAttribute(AutoDataAttribute autoDataAttribute, params object[] values)
     : base(new DataAttribute[] { new InlineDataAttribute(values), autoDataAttribute })
 {
     this.autoDataAttribute = autoDataAttribute;
     this.values            = values;
 }
示例#4
0
 public AutoDataAttribute(Type fixtureType)
     : this(AutoDataAttribute.CreateFixture(fixtureType))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InlineAutoDataAttribute"/> class.
 /// </summary>
 /// <param name="autoDataAttribute">An <see cref="AutoDataAttribute"/>.</param>
 /// <param name="values">The data values to pass to the theory.</param>
 public InlineAutoDataAttribute(AutoDataAttribute autoDataAttribute, params object[] values)
     : base(new DataAttribute[] { new InlineDataAttribute(values), autoDataAttribute })
 {
     this.autoDataAttribute = autoDataAttribute;
     this.values = values;
 }
 public InlineAutoMoqAttribute(AutoMoqDataAttribute autoMoqDataAttribute, params object[] values)
 : base(new InlineAutoMoqAttribute(values) as DataAttribute, autoMoqDataAttribute as DataAttribute)
 {
     AutoMoqDataAttribute = autoMoqDataAttribute;
     Values = values;
 }