public static Customer[] Generate() { var company = new Bogus.DataSets.Company(locale: "en"); var name = new Bogus.DataSets.Name("en"); var address = new Bogus.DataSets.Address("en_GB"); var fake = new Faker <Customer>("en") .StrictMode(true) .RuleFor(x => x.CustomerType, (f) => f.PickRandom(new[] { CustomerType.New, CustomerType.Continue })) .RuleFor(x => x.Name, (f) => name.FullName()) .RuleFor(x => x.Id, (f) => f.UniqueIndex) .RuleFor(x => x.Company, f => { return(company.CompanyName()); }) .RuleFor(x => x.Address, (f) => address.City()); var datas = new[] { fake.Generate(), fake.Generate(), fake.Generate(), fake.Generate(), fake.Generate(), fake.Generate(), fake.Generate() }; return(datas); }
private void GetDataSources(string locale) { this.DsName = this.Notifier.Flow <Name>(new Name(locale)); this.DsInternet = this.Notifier.Flow <Internet>(new Internet(locale)); SeedNotifier notifier = this.Notifier; Date date = new Date("en"); date.Locale = locale; this.DsDate = notifier.Flow <Date>(date); this.DsPhoneNumbers = this.Notifier.Flow <PhoneNumbers>(new PhoneNumbers(locale)); this.DsAddress = this.Notifier.Flow <Bogus.DataSets.Address>(new Bogus.DataSets.Address(locale)); this.DsCompany = this.Notifier.Flow <Bogus.DataSets.Company>(new Bogus.DataSets.Company(locale)); }
protected virtual void Initialize(string locale) { var gname = new Name(locale); this.FirstName = gname.FirstName(); this.LastName = gname.LastName(); var ginternet = new Internet(locale); this.UserName = ginternet.UserName(this.FirstName, this.LastName); this.Email = ginternet.Email(this.UserName, this.LastName); this.Website = ginternet.DomainName(); this.Avatar = ginternet.Avatar(); var gdate = new Date() { Locale = locale }; this.DateOfBirth = gdate.Past(50, DateTime.Now.AddYears(-20)); var gphone = new PhoneNumbers(locale); this.Phone = gphone.PhoneNumber(); var gaddress = new Address(locale); this.Address = new CardAddress { Street = gaddress.StreetAddress(), Suite = gaddress.SecondaryAddress(), City = gaddress.City(), ZipCode = gaddress.ZipCode(), Geo = new CardAddress.CardGeo { Lat = gaddress.Latitude(), Lng = gaddress.Longitude() } }; var gcompany = new Company(locale); this.Company = new CardCompany { Name = gcompany.CompanyName(), CatchPhrase = gcompany.CatchPhrase(), Bs = gcompany.Bs() }; }
public void BeforeEachTest() { company = new Company(); }