public FluencyConfiguration() { // Initialize default values. ConstructIdGenerator = () => new StaticValueIdGenerator(0); DefaultValueConventions = new List <IDefaultConvention> { // Strings Convention.ByName("Firstname", p => ARandom.FirstName()), Convention.ByName("LastName", p => ARandom.LastName()), Convention.ByName("FullName", p => ARandom.FullName()), Convention.ByName("City", p => ARandom.City()), Convention.ByName("State", p => ARandom.StateCode()), Convention.ByName("Zip", p => ARandom.ZipCode()), Convention.ByName("ZipCode", p => ARandom.ZipCode()), Convention.ByName("PostalCode", p => ARandom.ZipCode()), Convention.ByName("Email", p => ARandom.Email()), Convention.ByName("Address", p => String.Format("{0} {1} {2}", ARandom.IntBetween(10, 9999), ARandom.LastName(), ARandom.ItemFrom("Street", "Lane", "Ave.", "Blvd."))), Convention.ByName("Phone", p => ARandom.StringPattern("999-999-9999")), Convention.ByName("HomePhone", p => ARandom.StringPattern("999-999-9999")), Convention.ByName("WorkPhone", p => ARandom.StringPattern("999-999-9999")), Convention.ByName("BusinessPhone", p => ARandom.StringPattern("999-999-9999")), Convention.ByName("Fax", p => ARandom.StringPattern("999-999-9999")), Convention.String(20), // Dates Convention.ByName("BirthDate", p => ARandom.BirthDate()), Convention.DateType(), Convention.IntegerType(), Convention.ByType <Decimal>(p => ARandom.CurrencyAmount()) }; }
public Customer Customer() { var customer = new Customer { Id = GetUniqueId(), FirstName = ARandom.FirstName(), LastName = ARandom.LastName() }; return(customer); }
public AnonymousCustomerBuilder() { SetProperty(x => x.StoreId, ARandom.IntBetween(1000000, int.MaxValue)); //SetProperty(x => x.WebshopId, ARandom.IntBetween(1000000, int.MaxValue)); SetProperty(x => x.LastName, "Test_" + ARandom.LastName()); SetProperty(x => x.FirstName, "Test_" + ARandom.FirstName()); SetProperty(x => x.ShippingAddressStreet, "Test_" + ARandom.Text(15).TrimEnd()); SetProperty(x => x.ShippingAddressHomeNumber, ARandom.Text(5).TrimEnd()); SetProperty(x => x.ShippingAddressCity, ARandom.City()); SetProperty(x => x.ShippingAddressZip, ARandom.ZipCode()); SetProperty(x => x.ShippingAddressState, ""); SetProperty(x => x.ShippingAddressCountryId, (int?)ARandom.EnumValue <Enums.Country>()); SetProperty(x => x.ShippingAddressCountry, Enum.GetName(typeof(Enums.Country), ARandom.EnumValue <Enums.Country>())); SetProperty(x => x.Phone, ARandom.StringPattern("##/### ## ##")); SetProperty(x => x.Mobile, ARandom.StringPattern("####/## ## ##")); SetProperty(x => x.Email, "archive+" + ARandom.StringFromCharacterSet(15, "abcdefghijklmnopqrstuvwxyz").TrimEnd() + "@animatomusic.be"); SetProperty(x => x.BillingAddress1, ARandom.Text(15).TrimEnd()); SetProperty(x => x.BillingAddress2, ARandom.Text(15).TrimEnd()); SetProperty(x => x.BillingAddress3, ARandom.Text(15).TrimEnd()); SetProperty(x => x.BillingName, ARandom.Text(30).TrimEnd()); SetProperty(x => x.BillingContact, ARandom.Text(30).TrimEnd()); SetProperty(x => x.VatNumber, ARandom.Text(15).TrimEnd()); SetProperty(x => x.WebshopDiscount6, (byte)ARandom.IntBetween(0, 100)); SetProperty(x => x.WebshopDiscount21, (byte)ARandom.IntBetween(0, 100)); SetProperty(x => x.IsTeacher, ARandom.Boolean()); SetProperty(x => x.IsReseller, ARandom.Boolean()); SetProperty(x => x.Institution, ARandom.Text(50).TrimEnd()); SetProperty(x => x.TeacherCardNumber, "17511240450-000010"); SetProperty(x => x.TeacherCardValidFrom, ARandom.DateAfter(DateTime.Today)); SetProperty(x => x.TeacherCardValidTo, ARandom.DateAfter(DateTime.Today)); SetProperty(x => x.TeacherRegistrationNote, ARandom.Text(150).TrimEnd()); SetProperty(x => x.TeacherConfirmed, ARandom.DateTime()); SetProperty(x => x.TeachingSubjects, ARandom.Text(50).TrimEnd()); SetProperty(x => x.Test, true); SetProperty(x => x.CreatedDttm, ARandom.DateTimeInPast()); SetProperty(x => x.UpdatedDttm, ARandom.DateTimeInPast()); SetProperty(x => x.DeletedDttm, (DateTime?)null); }
/// <summary> /// Creates a convention to automatically assign a default value to a property:<br/> /// Assign a random first name when the property name contains "firstname" (case-insensitive) /// </summary> /// <returns>The constructed <see cref="IDefaultConvention{T}"/></returns> public static IDefaultConvention <string> FirstName() { return(ByName("FirstName", p => ARandom.FirstName())); }
protected override void SetupDefaultValues() { SetProperty(x => x.Id, GenerateNewId()); SetProperty(x => x.FirstName, ARandom.FirstName()); SetProperty(x => x.LastName, ARandom.LastName()); }