Class FieldSpecification
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
A specification that determines whether the request is a request
for a FieldInfo matching the specified name and Type.
public class FieldSpecification : IRequestSpecificationInheritance
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
FieldSpecification(Type, string)
Initializes a new instance of the FieldSpecification class.
public FieldSpecification(Type targetType, string targetName)Parameters
targetType Type
The Type with which the requested
FieldInfo type should be compatible.
targetName string
The name which the requested FieldInfo name
should match exactly.
Exceptions
targetType or
targetName is null.
FieldSpecification(IEquatable<FieldInfo>)
Initializes a new instance of the FieldSpecification class.
public FieldSpecification(IEquatable<FieldInfo> target)Parameters
target IEquatable<FieldInfo>
The criteria used to match the requested
FieldInfo.
Exceptions
target is null.
Properties
TargetName
The name which the requested FieldInfo 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
FieldInfo 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.