static void Main(string[] args) { // create data sets var nameDataSet = new Bogus.DataSets.Name(); var addressDataSet = new Bogus.DataSets.Address(); var phoneDataSet = new Bogus.DataSets.PhoneNumbers(); // create list to hold results var list = new List <Address>(); for (var i = 0; i < 780000; i++) { // generate a result var address = new Address(); address.First = nameDataSet.FirstName(); address.Last = nameDataSet.LastName(); address.Street = addressDataSet.StreetAddress(); address.City = addressDataSet.City(); address.State = addressDataSet.State(); address.Zip = addressDataSet.ZipCode(); address.Phone = phoneDataSet.PhoneNumberFormat(0); list.Add(address); } // serialize to output.json var json = Newtonsoft.Json.JsonConvert.SerializeObject(list); File.WriteAllText("output.json", json); }
/// <summary> /// Método responsável por criar um usuario para uso no sistema. /// </summary> /// <returns></returns> public Usuario UsuarioPadrao() { var faker = new Faker("pt_BR"); var estadoFaker = new Bogus.DataSets.Address("en"); var usuario = new Usuario { Sexo = faker.Random.Bool() ? 'F' : 'M', PrimeiroNome = faker.Name.FirstName(), UltimoNome = faker.Name.LastName(), Password = "******" }; usuario.Email = faker.Internet.Email(usuario.PrimeiroNome); usuario.DataAniversario = DateTime.Now.AddYears(-20); usuario.Empresa = faker.Company.CompanyName(); usuario.EmpresaEndereco = faker.Address.StreetAddress(); usuario.Cidade = faker.Address.City(); usuario.Estado = estadoFaker.State(); usuario.Cep = "12345"; usuario.Pais = "United States"; usuario.InformacaoAdicional = faker.Lorem.Lines(); usuario.TelefoneComDDD = "(23)34732957"; usuario.CelularComDDD = "(55)947345729"; usuario.EnderecoAlternativo = faker.Random.Bool() ? "Home" : "Work"; return(usuario); }
private static Customer CreateCustomer(_CustomerType type) { var name = new Bogus.DataSets.Name(); var address = new Bogus.DataSets.Address(); var random = new Randomizer(); if (type == _CustomerType.Individual) { var phoneNo = new Bogus.DataSets.PhoneNumbers(); return(new IndividualCustomer() { FirstName = name.FirstName(), LastName = name.LastName(), CustomerType = type.ToString(), Street = address.StreetName(), City = address.City(), State = address.State(), Zipcode = int.Parse(address.ZipCode("######")), PhoneNo = int.Parse(phoneNo.PhoneNumber("########")), Age = random.Number(18, 100), Gender = (int)random.Enum <_Gender>() }); } else if (type == _CustomerType.Enterprise) { var companyName = new Bogus.DataSets.Company(); return(new EnterpriseCustomer() { FirstName = name.FirstName(), LastName = name.LastName(), CustomerType = type.ToString(), Street = address.StreetName(), City = address.City(), State = address.State(), Zipcode = int.Parse(address.ZipCode("######")), OrganizationName = companyName.CompanyName() + companyName.CompanySuffix(), OrganizationType = random.Enum <_OrganizationType>().ToString() }); } else { return(null); } }