Class OmitEnumerableParameterRequestRelay
Relays requests for enumerable 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 OmitEnumerableParameterRequestRelay : ISpecimenBuilder
Remarks
The OmitEnumerableParameterRequestRelay class works like ParameterRequestRelay, except that it only handles System.Reflection.ParameterInfo instances where System.Reflection.ParameterInfo.ParameterType is System.Collections.Generic.IEnumerable<T>. 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 enumerable 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
System.Collections.Generic.IEnumerable<T>. If context
returns an OmitSpecimen instance, an empty array of
the correct type is returned instead.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|