/// <summary> /// Creates a string that is guaranteed to match a RegularExpressionRequest. /// </summary> /// <param name="request">The request that describes what to create.</param> /// <param name="context">A context that can be used to create other specimens.</param> /// <returns> /// The requested specimen if possible; otherwise a <see cref="NoSpecimen"/> instance. /// </returns> public object Create(object request, ISpecimenContext context) { if (request == null) { return(new NoSpecimen()); } var regularExpressionRequest = request as RegularExpressionRequest; if (regularExpressionRequest == null) { return(new NoSpecimen(request)); } return(RegularExpressionGenerator.CreateAnonymous(regularExpressionRequest)); }
/// <summary> /// Creates a string that is guaranteed to match a RegularExpressionRequest. /// </summary> /// <param name="request">The request that describes what to create.</param> /// <param name="context">A context that can be used to create other specimens.</param> /// <returns> /// The requested specimen if possible; otherwise a <see cref="NoSpecimen"/> instance. /// </returns> public object Create(object request, ISpecimenContext context) { if (request == null) { return(new NoSpecimen()); } var regularExpressionRequest = request as RegularExpressionRequest; if (regularExpressionRequest == null) { #pragma warning disable 618 return(new NoSpecimen(request)); #pragma warning restore 618 } return(RegularExpressionGenerator.CreateAnonymous(regularExpressionRequest)); }