Class PropertySpecification
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
A specification that determines whether the request is a request
for a PropertyInfo matching a particular property,
according to the supplied comparison rules.
public class PropertySpecification : IRequestSpecificationInheritance
object ← PropertySpecification
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
PropertySpecification(Type, string)
Initializes a new instance of the PropertySpecification class.
public PropertySpecification(Type targetType, string targetName)Parameters
targetType Type
The Type with which the requested
PropertyInfo type should be compatible.
targetName string
The name which the requested PropertyInfo name
should match exactly.
Exceptions
targetType or
targetName is null.
PropertySpecification(IEquatable<PropertyInfo>)
Initializes a new instance of the
PropertySpecification class.
public PropertySpecification(IEquatable<PropertyInfo> target)Parameters
target IEquatable<PropertyInfo>
The criterion used to match the requested
PropertyInfo with the specified value.
Exceptions
target is null.
Properties
TargetName
The name which the requested PropertyInfo name
should match exactly.
[Obsolete("This value is only available if the constructor taking a target type and name is used. Otherwise, it'll be null. Use with caution. This property will be removed in a future version of AutoFixture.", true)]
public string TargetName { get; }Property Value
TargetType
The Type with which the requested
PropertyInfo type should be compatible.
[Obsolete("This value is only available if the constructor taking a target type and name is used. Otherwise, it'll be null. Use with caution. This property will be removed in a future version of AutoFixture.", true)]
public Type TargetType { get; }Property Value
Methods
IsSatisfiedBy(object)
Evaluates a request for a specimen.
public bool IsSatisfiedBy(object request)Parameters
request object
The specimen request.
Returns
true if request is satisfied by the Specification;
otherwise, false.