public List <MedOrg> GenerateMedOrgs() { List <MedOrg> medOrgs = new List <MedOrg>(); DirectoryInfo directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent?.Parent; XDocument xdoc = XDocument.Load(directory?.FullName + ".DAL/Classes/Addresses.xml"); List <string> elem = xdoc.Root?.Elements().Elements().Select(s => s.Value).ToList(); for (int i = 0; i < random.Next(1, 10); i++) { MedOrg medOrg = new MedOrg() { Name = NameGenerator.GenerateLastName().ToLower(), PhoneNumber = $"+7({random.Next(100, 1000)})-" + $"{random.Next(100, 1000)}-" + $"{random.Next(10, 100)}-" + $"{random.Next(10, 100)}", Address = elem?[random.Next(elem.Count)], Patients = GeneratePatients(), UsersOfMedOrg = GenerateUsers() }; Thread.Sleep(30); medOrgs.Add(medOrg); } return(medOrgs); }
public static string GenerateEmail() { var gender = (GenderEnum)(_random.Next(1000) % 2 == 0 ? 0 : 1); var name = NameGenerator.GenerateFirstName(gender); var surname = NameGenerator.GenerateLastName(); var special1 = _randomSpecial[_random.Next(_randomSpecial.Length)].ToString(); var special2 = _randomSpecial[_random.Next(_randomSpecial.Length)].ToString(); var domain = DomainGenerator.GenerateDomain("@mail."); var dateYear = _random.Next(1950, 2018).ToString(); var randPath = _random.Next(4); switch (randPath) { case 0: return($"{name}{special1}{surname}{domain}".ToLower()); case 1: return($"{surname}{special1}{name}{special2}{dateYear}{domain}".ToLower()); case 2: return($"{name}{special1}{surname}{dateYear}{domain}".ToLower()); case 3: return($"{surname}{special2}{special1}{dateYear}{domain}".ToLower()); default: throw new ArgumentOutOfRangeException(); } }
public List <Car> CreateCar() { List <Car> Cars = new List <Car>(); for (int i = 0; i < Rnd.Next(1, 10); i++) { Car car = new Car() { Components = CreateComponent.GenerateComponents(), GarageNuber = $"{_pwdChars[Rnd.Next(0,_pwdChars.Length)]}" + $"{Rnd.Next(0,10)}" + $"{Rnd.Next(0, 10)}" + $"{Rnd.Next(0, 10)}" + $"{_pwdChars[Rnd.Next(0, _pwdChars.Length)]}" + $"{_pwdChars[Rnd.Next(0, _pwdChars.Length)]}" + $"{_pwdChars[Rnd.Next(0, _pwdChars.Length)]}", Model = NameGenerator.GenerateLastName().ToLower(), Name = NameGenerator.GenerateFirstName((Gender)Rnd.Next(0, 2)).ToLower(), TypeOfCar = (TypeOfCar)Rnd.Next(0, 2), YearOfIssue = Rnd.Next(1950, 2019) }; Cars.Add(car); } return(Cars); }
public static List <Student> GenerateStudents() { Random Rnd = new Random(); List <Student> students = new List <Student>(); for (int i = 0; i < Rnd.Next(15, 25); i++) { Student student = new Student() { Name = NameGenerator.GenerateFirstName((Gender)Rnd.Next(0, 2)), FullName = NameGenerator.GenerateLastName(), Grades = new int[Rnd.Next(5, 10)] }; for (int j = 0; j < student.Grades.Length; j++) { student.Grades[j] = Rnd.Next(2, 6); if (student.Grades[0] == 4 || student.Grades[0] == 5) { student.Grades[j] = Rnd.Next(4, 6); } } students.Add(student); } return(students); }
public async Task AddAppUsers() { int numAppUsersToCreate = 50; AppUserRepository repo = new AppUserRepository(); Random rdm = new Random(); for (int i = 0; i < numAppUsersToCreate; i++) { string firstName = NameGenerator.GenerateFirstName((Gender)rdm.Next(0, 1)); firstName = firstName.Substring(0, 1) + firstName.Substring(1).ToLower(); string lastName = NameGenerator.GenerateLastName(); lastName = lastName.Substring(0, 1) + lastName.Substring(1).ToLower(); string userName = firstName.ToLower() + lastName; string avatarUrl = "https://api.adorable.io/avatars/" + rdm.Next(235, 3571); await repo.Add(new AppUser() { UserName = userName, FirstName = firstName, LastName = lastName, AvatarUrl = avatarUrl, Location = "Nowhere", RegistrationDate = DateTime.UtcNow.ToString() }); } }
public static string LastName() { string name = string.Empty; name = NameGenerator.GenerateLastName(); return(name); }
public AbstractCharacter() { ListObject = new List <AbstractObject>(); Name = NameGenerator.GenerateLastName(); Name = new System.Globalization.CultureInfo("en-US", false).TextInfo.ToTitleCase(Name.ToLower()); SimpleName = Name; Life = 100; Death = false; }
public virtual void GenerateRandData() { LastName = NameGenerator.GenerateLastName(); int randYear = random.Next(DateTime.Now.Year - 100, DateTime.Now.Year); int randMonth = random.Next(1, 12); int randDay = random.Next(1, DateTime.DaysInMonth(randYear, randMonth)); this.StartDate = DateTime.Parse($"{randYear}-{randMonth}-{randDay}"); Thread.Sleep(30); }
public ISearchable GenerateSearchable() { var person = new Person(); person.FirstName = NameGenerator.GenerateFirstName(Gender.Male); person.LastName = NameGenerator.GenerateLastName(); person.Age = _random.Next(18, 65); return(new ReflectionSearchable(person)); }
public List <Part> GenerateComponents() { List <Part> Components = new List <Part>(); for (int i = 0; i < Rnd.Next(1, 20); i++) { Part component = new Part() { ComponentId = Rnd.Next(1000, 10000), Name = NameGenerator.GenerateLastName().ToLower() }; Thread.Sleep(30); Components.Add(component); } return(Components); }
public virtual void RandomlyGenerateData() { this.Name = NameGenerator.GenerateLastName().ToLower(); this.PhoneNumber = $"+7({Rnd.Next(100, 1000)})-" + $"{Rnd.Next(100, 1000)}-" + $"{Rnd.Next(10, 100)}-" + $"{Rnd.Next(10, 100)}"; //Получение адреса рандомно DirectoryInfo directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent?.Parent; XDocument xdoc = XDocument.Load(directory?.FullName + "/Task5/Addresses.xml"); List <string> elem = xdoc.Root?.Elements().Elements().Select(s => s.Value).ToList(); this.Address = elem?[Rnd.Next(elem.Count)]; Thread.Sleep(30); }
public new void SeedCustomers(DataContext context) { long cnp = 1111111111111; for (int i = 0; i < _count; i++) { context.Customers.AddOrUpdate(new Customer { Cnp = cnp++.ToString(), Name = FirstLetterToUpper(NameGenerator.GenerateFirstName( _random.NextDouble() >= 0.5 ? Gender.Male : Gender.Female)), LastName = FirstLetterToUpper(NameGenerator.GenerateLastName()), Phone = "070012345678" }); } context.SaveChanges(); }
public async Task <string> GetTemplate() { var status = new Status() { Date = DateTime.Now, User = new User() { FirstName = NameGenerator.GenerateFirstName(Gender.Male), LastName = NameGenerator.GenerateLastName() } }; var tpl = await System.IO.File.ReadAllTextAsync("./status.json"); var tplKey = "statusKey"; var payload = await _renderService.Render(tplKey, tpl, status); return(payload.Replace(System.Environment.NewLine, "").Replace(" ", "")); }
/// <summary> /// Generates a random Customer object. /// </summary> /// <returns>The created Customer object.</returns> private Customer GetRandomCustomer() { if (rand.Next(0, 2) == 0) { return(new Customer( NameGenerator.GenerateFirstName(Gender.Female), NameGenerator.GenerateLastName(), GetRandomString(7) + "@random.org", GetRandomPhone())); } else { return(new Customer( NameGenerator.GenerateFirstName(Gender.Male), NameGenerator.GenerateLastName(), GetRandomString(7) + "@random.org", GetRandomPhone())); } }
public List <Patient> GeneratePatients() { List <Patient> patients = new List <Patient>(); for (int i = 0; i < random.Next(1, 50); i++) { Patient patient = new Patient() { FirstName = NameGenerator.GenerateFirstName((Gender)random.Next(0, 2)).ToLower(), SecondName = NameGenerator.GenerateFirstName((Gender)random.Next(0, 2)).ToLower(), LastName = NameGenerator.GenerateLastName().ToLower(), IIN = $"{random.Next(1000, 9999)}{random.Next(1000, 9999)}{random.Next(1000, 9999)}" }; Thread.Sleep(30); patients.Add(patient); } return(patients); }
public List <User> GenerateUsers() { List <User> users = new List <User>(); for (int i = 0; i < Rnd.Next(1, 10); i++) { User user = new User { Login = NameGenerator.GenerateLastName().ToLower(), Password = "******", //Project = projects[Rnd.Next(0, projects.Count)] }; users.Add(user); } List <Admin> admins = new List <Admin>(); for (int i = 0; i < Rnd.Next(1, 10); i++) { Admin admin = new Admin { Login = NameGenerator.GenerateLastName().ToLower(), Password = "******" }; admins.Add(admin); } XmlSerializer xmlUser = new XmlSerializer(typeof(List <User>)); using (FileStream fs = new FileStream("Users.xml", FileMode.OpenOrCreate)) { xmlUser.Serialize(fs, users); } XmlSerializer xmlAdmin = new XmlSerializer(typeof(List <Admin>)); using (FileStream fs = new FileStream("Admins.xml", FileMode.OpenOrCreate)) { xmlAdmin.Serialize(fs, admins); } return(users); }
/* * Survival */ public override void Awake() { base.Awake(); _thing = GetComponent <Thing>(); _game = FindObjectOfType <Game>(); _movement = transform.gameObject.AddComponent <Movement>(); _inventory = _thing.Inventory; Needs = transform.gameObject.AddComponent <Needs>(); _firstname = NameGenerator.GenerateFirstName(); _lastname = NameGenerator.GenerateLastName(); _thing.name = string.Format("{0} {1}", _firstname, _lastname); _villagerManager = MonoBehaviour.FindObjectOfType <VillageManager>(); //IdleAction = new Idle(this, _game, _movement); AddGoal(new IdleGoal()); AddGoal(new WorkingGoal()); AddGoal(new DrinkGoal(Needs)); AddGoal(new EatGoal(Needs)); AddGoal(new RestGoal(_game, Needs)); /* * Misc */ AddAction(new Drop(this, _game)); AddAction(new Sleep(this, _game, _thing, _movement, this, Needs)); AddAction(new Idle(this, _game, _movement)); AddAction(new ChopWood(this, _game, _movement)); AddAction(new PickMushroom(this, _game, _movement)); AddAction(new GetClayFromGround(this, _game, _movement)); /* * Survival */ AddAction(new DrinkFromStream(this, _game, _movement)); AddAction(new EastSomething(this, _game, _thing)); AddAction(new HasEdibleThing(this, _game, TypeOfThing.Mushroom)); /* * Resources */ var resources = new TypeOfThing[] { TypeOfThing.Water, TypeOfThing.Stream, TypeOfThing.Rock, TypeOfThing.Stone, TypeOfThing.MushroomGrowing, TypeOfThing.Mushroom, TypeOfThing.Tree, TypeOfThing.FallenWood, TypeOfThing.Wood, TypeOfThing.WoodenPlanks, TypeOfThing.ClayFloor, TypeOfThing.Clay, TypeOfThing.OreFloor, TypeOfThing.Ore, TypeOfThing.Iron, TypeOfThing.CabbageSeed, TypeOfThing.PotatoSeed, TypeOfThing.CarrotSeed, TypeOfThing.PumpkinSeed, TypeOfThing.HopSeed, TypeOfThing.TomatoSeed, TypeOfThing.Cabbage, TypeOfThing.PotatoSeed, TypeOfThing.Carrot, TypeOfThing.Hops, TypeOfThing.Axe, TypeOfThing.Hoe, TypeOfThing.WateringPot }; foreach (var resource in resources) { AddAction(new GetThing(this, _game, _thing, _movement, resource)); //AddAction(new GetThingToMoveToStorage(this, _game, _thing, _movement, resource, this)); //AddAction(new FillStorage(this, _game, _movement, _thing.Inventory, resource)); } /* * Factory Job */ // var factoryJobs = new List<Tuple<TypeOfThing, TypeOfThing, TypeOfThing, bool>>() // { // Tuple.Create(TypeOfThing.ClayForge, TypeOfThing.Ore, TypeOfThing.Iron, false), // Tuple.Create(TypeOfThing.Workbench, TypeOfThing.Iron, TypeOfThing.Axe, true), // Tuple.Create(TypeOfThing.Workbench, TypeOfThing.Iron, TypeOfThing.Hoe, true), // Tuple.Create(TypeOfThing.CarpentersBench, TypeOfThing.Wood, TypeOfThing.WoodenPlanks, true), // Tuple.Create(TypeOfThing.Kiln, TypeOfThing.Clay, TypeOfThing.WateringPot, false) // }; // foreach(var job in factoryJobs) // { // AddAction(new SubmitFactoryJob(this, _game, _thing, _movement, job.Item1, job.Item2, job.Item3, job.Item4)); // } /* * Construction */ AddAction(new Construct(this, _game, _movement, TypeOfThing.Wood, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.WoodenPlanks, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.Stone, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.Clay, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.Hoe, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.CabbageSeed, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.PotatoSeed, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.TomatoSeed, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.PumpkinSeed, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.CarrotSeed, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.Water, _thing)); AddAction(new Construct(this, _game, _movement, TypeOfThing.None, _thing)); }
public static Student Generate(string gender) { return(new Student(GetName("M"), NameGenerator.GenerateLastName(), (uint)(new Random()).Next(999999), (new List <Course>()).Add(Course.Generate()))); }
public void ShouldGenerateLastName() { var lastName = NameGenerator.GenerateLastName(); Assert.AreEqual(string.IsNullOrEmpty(lastName), false); }