Class AutoPropertiesCommand
A command that assigns anonymous values to all writable properties and fields of a type.
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class AutoPropertiesCommand : AutoPropertiesCommand<object>, ISpecimenCommand, ObsoletedMemberShims.ISpecifiedSpecimenCommand<object>, ISpecifiedSpecimenCommand<object>, IRequestSpecification
Constructors
| Improve this Doc View SourceAutoPropertiesCommand()
Initializes a new instance of the AutoPropertiesCommand class.
Declaration
public AutoPropertiesCommand()
Remarks
When created without an explicit specimen type, the AutoPropertiesCommand will infer the specimen type from the actual specimen instance.
AutoPropertiesCommand(IRequestSpecification)
Initializes a new instance of the AutoPropertiesCommand class with 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.
AutoPropertiesCommand(Type)
Initializes a new instance of the AutoPropertiesCommand class with the supplied specimen type.
Declaration
public AutoPropertiesCommand(Type specimenType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | specimenType | The specimen type on which properties are assigned. |
AutoPropertiesCommand(Type, IRequestSpecification)
Initializes a new instance of the AutoPropertiesCommand class with the supplied specimen type and specification.
Declaration
public AutoPropertiesCommand(Type specimenType, IRequestSpecification specification)
Parameters
Type | Name | Description |
---|---|---|
System.Type | specimenType | The specimen type on which properties are assigned. |
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 SourceExplicitSpecimenType
The explicitly specified System.Type that should be used to resolve fields and properties
to populate for the specimen.
Property will return null if no explicit specimen type was specified during the command construction.
In this case command uses the runtime type of the generated specimen to resolve its fields and properties.
Declaration
public Type ExplicitSpecimenType { get; }
Property Value
Type | Description |
---|---|
System.Type |
Methods
| Improve this Doc View SourceGetSpecimenType(Object)
Gets the type of the specimen.
Declaration
protected override Type GetSpecimenType(object specimen)
Parameters
Type | Name | Description |
---|---|---|
System.Object | specimen | The specimen. |
Returns
Type | Description |
---|---|
System.Type | The type of the specimen. |
Overrides
Remarks
This implementation ignores specimen
and returns the type parameter
of AutoPropertiesCommand<T>.