/// <summary> /// Populate the specified property with a first name /// </summary> /// <typeparam name="T">The target object type</typeparam> /// <param name="configurator"></param> /// <returns>A configurator for the specified object type</returns> public static GenFuConfigurator <T> AsFirstName <T>(this GenFuStringConfigurator <T> configurator) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => Names.FirstName()); configurator.Maggie.RegisterFiller(filler); return(configurator); }
/// <summary> /// Populate the specified property with a valid email address for a particular domain /// </summary> /// <typeparam name="T">The target object type</typeparam> /// <param name="configurator"></param> /// <param name="domain">The domain name for the email address</param> /// <returns>A configurator for the specified object type</returns> public static GenFuConfigurator <T> AsEmailAddressForDomain <T>(this GenFuStringConfigurator <T> configurator, string domain) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => ContactInformation.Email(domain)); configurator.Maggie.RegisterFiller(filler); return(configurator); }
/// <summary> /// Populate the specified property with a valid phone number /// </summary> /// <typeparam name="T">The target object type</typeparam> /// <param name="configurator"></param> /// <returns>A configurator for the specified object type</returns> public static GenFuConfigurator <T> AsPhoneNumber <T>(this GenFuStringConfigurator <T> configurator) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => ContactInformation.PhoneNumber()); configurator.Maggie.RegisterFiller(filler); return(configurator); }
/// <summary> /// Populate the specified property with a loerm ipsum sentence /// </summary> /// <typeparam name="T">The target object type</typeparam> /// <param name="configurator"></param> /// <returns>A configurator for the specified object type</returns> public static GenFuConfigurator <T> AsLoremIpsumSentences <T>(this GenFuStringConfigurator <T> configurator, int numberOfSentences = 1) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => ValueGenerators.Lorem.Lorem.GenerateSentences(numberOfSentences)); configurator.Maggie.RegisterFiller(filler); return(configurator); }
/// <summary> /// Populate the specified property with a music genre description /// </summary> /// <typeparam name="T">The target object type</typeparam> /// <param name="configurator"></param> /// <returns>A configurator for the specified object type</returns> public static GenFuConfigurator <T> AsMusicGenreDescription <T>(this GenFuStringConfigurator <T> configurator) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => ValueGenerators.Music.Genre.Description()); configurator.Maggie.RegisterFiller(filler); return(configurator); }
/// <summary> /// Populate the specified property with a Canadian province name /// </summary> /// <typeparam name="T">The target object type</typeparam> /// <param name="configurator"></param> /// <returns>A configurator for the specified object type</returns> public static GenFuConfigurator <T> AsCanadianProvince <T>(this GenFuStringConfigurator <T> configurator) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => Address.CanadianProvince()); configurator.Maggie.RegisterFiller(filler); return(configurator); }
public static GenFuConfigurator <T> AsPlaceholderImage <T>(this GenFuStringConfigurator <T> configurator, int width, int height, string text = null, string backgroundColor = null, string textColor = null, ImgFormat format = ImgFormat.GIF) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => PlaceholditUrlBuilder.UrlFor(width, height, text, backgroundColor, textColor, format)); configurator.Maggie.RegisterFiller(filler); return(configurator); }
public static GenFuConfigurator <T> AsPlaceholderImage <T>(this GenFuStringConfigurator <T> configurator, int width, int height, string text = null, string backgroundColor = null, string textColor = null, object htmlAttributes = null, ImgFormat format = ImgFormat.GIF) where T : new() { CustomFiller <string> filler = new CustomFiller <string>(configurator.PropertyInfo.Name, typeof(T), () => new StringBuilder() .Append("http://placehold.it/") .Append($"{width}x{height}") .AppendWhen($".{format}", format != ImgFormat.GIF) .AppendWhen($"/{backgroundColor}", !string.IsNullOrWhiteSpace(backgroundColor)) .AppendWhen($"/{textColor}", !string.IsNullOrWhiteSpace(textColor)) .AppendWhen($"?text={text}", !string.IsNullOrWhiteSpace(text)) .ToString()); configurator.Maggie.RegisterFiller(filler); return(configurator); }