Class AutoPropertiesCommand<T>
A command that assigns anonymous values to all writable properties and fields of a type.
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
[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, ObsoletedMemberShims.ISpecifiedSpecimenCommand<T>, ISpecifiedSpecimenCommand<T>, IRequestSpecification
Type Parameters
Name | Description |
---|---|
T | The specimen type on which properties are assigned. |
Constructors
| Improve this Doc View SourceAutoPropertiesCommand()
Initializes a new instance of the AutoPropertiesCommand<T> class.
Declaration
public AutoPropertiesCommand()
AutoPropertiesCommand(IRequestSpecification)
Initializes a new instance of the AutoPropertiesCommand<T> class with the the supplied specification.
Declaration
public AutoPropertiesCommand(IRequestSpecification specification)
Parameters
Type | Name | Description |
---|---|---|
IRequestSpecification | specification | 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
| Improve this Doc View SourceSpecification
Specification that filters properties and files that should be populated.
Declaration
public IRequestSpecification Specification { get; }
Property Value
Type | Description |
---|---|
IRequestSpecification |
Methods
| Improve this Doc View SourceExecute(T, ISpecimenContext)
Assigns anonymous values to properties and fields on a specimen.
Declaration
[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
Type | Name | Description |
---|---|---|
T | specimen | The specimen on which property and field values will be assigned. |
ISpecimenContext | context | An ISpecimenContext that is used to create property and field values. |
Execute(Object, ISpecimenContext)
Assigns anonymous values to properties and fields on a specimen.
Declaration
public void Execute(object specimen, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | specimen | |
ISpecimenContext | context |
GetSpecimenType(Object)
Gets the type of the specimen.
Declaration
protected virtual Type GetSpecimenType(object specimen)
Parameters
Type | Name | Description |
---|---|---|
System.Object | specimen | The specimen. |
Returns
Type | Description |
---|---|
System.Type | The type of the specimen. |
Remarks
This implementation ignores specimen
and returns the type parameter
of AutoPropertiesCommand<T>.
IsSatisfiedBy(Object)
Evaluates whether a request matches a property or field affected by this command.
Declaration
[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
Type | Name | Description |
---|---|---|
System.Object | request | The specimen request. |
Returns
Type | Description |
---|---|
System.Boolean | true if |