Class AutoPropertiesCommand<T>
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
A command that assigns anonymous values to all writable properties and fields of a type.
[Obsolete("The generic version of the AutoPropertiesCommand is no longer used and will be removed in future versions. Please use the non-generic version of the AutoPropertiesCommand type.")]
public class AutoPropertiesCommand<T> : ISpecimenCommand, ISpecifiedSpecimenCommand<T>, IRequestSpecificationType Parameters
T
The specimen type on which properties are assigned.
Inheritance
object ← AutoPropertiesCommand<T>
Implements
ISpecimenCommand, ISpecifiedSpecimenCommand<T>, IRequestSpecification
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
AutoPropertiesCommand()
Initializes a new instance of the AutoPropertiesCommand%601 class.
public AutoPropertiesCommand()AutoPropertiesCommand(IRequestSpecification)
Initializes a new instance of the AutoPropertiesCommand%601 class with the
the supplied specification.
public AutoPropertiesCommand(IRequestSpecification specification)Parameters
specification IRequestSpecification
A specification that is used as a filter to include properties or fields.
Remarks
Only properties or fields satisfied by specification will get
assigned values.
Properties
Specification
Specification that filters properties and files that should be populated.
public IRequestSpecification Specification { get; }Property Value
Methods
Execute(T, ISpecimenContext)
Assigns anonymous values to properties and fields on a specimen.
[Obsolete("This method is no longer used and will be removed in future versions. Please use the Execute(object, ISpecimenContext) overload instead.")]
public void Execute(T specimen, ISpecimenContext context)Parameters
specimen T
The specimen on which property and field values will be assigned.
context ISpecimenContext
An ISpecimenContext that is used to create property and field values.
Execute(object, ISpecimenContext)
Assigns anonymous values to properties and fields on a specimen.
public void Execute(object specimen, ISpecimenContext context)Parameters
specimen object
context ISpecimenContext
GetSpecimenType(object)
Gets the type of the specimen.
protected virtual Type GetSpecimenType(object specimen)Parameters
specimen object
The specimen.
Returns
The type of the specimen.
Remarks
This implementation ignores specimen and returns the type parameter
of `AutoPropertiesCommand%601`.
IsSatisfiedBy(object)
Evaluates whether a request matches a property or field affected by this command.
[Obsolete("This method is no longer used and will be removed in future versions. Please use the this.Specification.IsSpecifiedBy(request) method instead.")]
public bool IsSatisfiedBy(object request)Parameters
request object
The specimen request.
Returns
true if request is a PropertyInfo
or FieldInfo that identifies a property or field affected by this
AutoPropertiesCommand%601; otherwise, false.