Class OmitArrayParameterRequestRelay
Relays requests for array parameters, and returns an empty array if the object returned from the context is an OmitSpecimen instance.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class OmitArrayParameterRequestRelay : ISpecimenBuilder
Remarks
The OmitArrayParameterRequestRelay class works like ParameterRequestRelay, except that it only handles System.Reflection.ParameterInfo instances where System.Reflection.ParameterInfo.ParameterType is and array. If the value returned from the context is an OmitSpecimen instance, it returns an empty array.
Methods
| Improve this Doc View SourceCreate(Object, ISpecimenContext)
Creates a specimen based on a requested array parameter.
Declaration
public object Create(object request, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request that describes what to create. |
ISpecimenContext | context | A context that can be used to create other specimens. |
Returns
Type | Description |
---|---|
System.Object | A specimen created from a SeededRequest encapsulating the parameter type and name of the requested parameter, if possible; otherwise, a NoSpecimen. |
Remarks
This method only handles System.Reflection.ParameterInfo instances
where System.Reflection.ParameterInfo.ParameterType is an array. If
context
returns an OmitSpecimen
instance, an empty array of the correct type is returned instead.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|