Src/AutoFixture/DataAnnotations/RangeAttributeRelay.cs
/// <summary>
/// Creates a new specimen based on a requested range.
/// </summary>
/// <param name="request">The request that describes what to create.</param>
/// <param name="context">A container that can be used to create other specimens.</param>
/// <returns>
/// A specimen created from a <see cref="RangedRequest"/> encapsulating the operand
/// type, the minimum and the maximum of the requested value, if possible; otherwise,
/// a <see cref="NoSpecimen"/> instance.
/// </returns>
Creates a new specimen based on a requested range.
Creates a new specimen based on a requested range .
public object Create(object request, ISpecimenContext context)
        {
            if (request == null)
            {
                return new NoSpecimen();
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            var rangeAttribute = TypeEnvy.GetAttribute<RangeAttribute>(request);
            if (rangeAttribute == null)
            {
                return new NoSpecimen();
            }
            var memberType = GetMemberType(rangeAttribute, request);
            var rangedRequest =
                new RangedRequest(
                    memberType,
                    rangeAttribute.OperandType,
                    rangeAttribute.Minimum,
                    rangeAttribute.Maximum);
            return context.Resolve(rangedRequest);
        }
public object Create ( object request , ISpecimenContext context ) { if ( request == null ) { return new NoSpecimen ( ) ; } if ( context == null ) { throw new ArgumentNullException ( nameof ( context ) ) ; } var rangeAttribute = TypeEnvy . GetAttribute < RangeAttribute > ( request ) ; if ( rangeAttribute == null ) { return new NoSpecimen ( ) ; } var memberType = GetMemberType ( rangeAttribute , request ) ; var rangedRequest = new RangedRequest ( memberType , rangeAttribute . OperandType , rangeAttribute . Minimum , rangeAttribute . Maximum ) ; return context . Resolve ( rangedRequest ) ; }
Creates a new specimen based on a requested range.
Creates a new specimen based on a requested range .
A specimen created from a  encapsulating the operand
type, the minimum and the maximum of the requested value, if possible; otherwise,
a  instance.
A specimen created from a encapsulating the operand type the minimum and the maximum of the requested value if possible ; otherwise a instance .
request
object
The request that describes what to create.
The request that describes what to create .
context
ISpecimenContext
A container that can be used to create other specimens.
A container that can be used to create other specimens .