private void SetupHeadHunterFakers(Lorem lorem) { _headHunterAreaFaker = new Faker <HeadHunterArea>() .RuleFor(a => a.Id, f => f.Random.Number(1, 10).ToString()) .RuleFor(a => a.Name, f => f.Address.City()); _headHunterEmployerFaker = new Faker <HeadHunterEmployer>() .RuleFor(e => e.Id, f => f.Random.Number(1, 10).ToString()) .RuleFor(e => e.Name, f => f.Company.CompanyName()) .RuleFor(e => e.Url, f => f.Internet.Url()); _headHunterSalaryFaker = new Faker <HeadHunterSalary>() .RuleFor(s => s.Currency, f => f.Finance.Currency().Code) .RuleFor(s => s.From, f => f.Random.Number(1, 10)) .RuleFor(s => s.To, f => f.Random.Number(1, 10)) .RuleFor(s => s.IsGross, f => f.Random.Bool()); _headHunterSkillFaker = new Faker <HeadHunterSkill>() .RuleFor(s => s.Name, f => lorem.Word()); _headHunterScheduleFaker = new Faker <HeadHunterSchedule>() .RuleFor(s => s.Id, f => lorem.Word()) .RuleFor(s => s.Name, f => lorem.Sentence()); _headHunterEmploymentFaker = new Faker <HeadHunterEmployment>() .RuleFor(s => s.Id, f => lorem.Word()) .RuleFor(s => s.Name, f => lorem.Sentence()); _headHunterVacancyFaker = new Faker <HeadHunterVacancy>() .RuleFor(v => v.Id, f => f.Random.Number(1, 10).ToString()) .RuleFor(v => v.Area, f => _headHunterAreaFaker.Generate()) .RuleFor(v => v.Employer, f => _headHunterEmployerFaker.Generate()) .RuleFor(v => v.Description, f => lorem.Text()) .RuleFor(v => v.Name, f => lorem.Sentence()) .RuleFor(v => v.Salary, f => _headHunterSalaryFaker.Generate()) .RuleFor(v => v.Url, f => f.Internet.Url()) .RuleFor(v => v.IsPremium, f => f.Random.Bool()) .RuleFor(v => v.CreatedDate, f => f.Date.Past()) .RuleFor(v => v.UpdateDate, (f, v) => v.CreatedDate) .RuleFor(v => v.RawData, f => lorem.Text()) .RuleFor(v => v.KeySkills, f => new List <HeadHunterSkill> { _headHunterSkillFaker.Generate() }) .RuleFor(v => v.Schedule, f => _headHunterScheduleFaker.Generate()) .RuleFor(v => v.Employment, f => _headHunterEmploymentFaker.Generate()); }
private static void SetupVacancyFakers(Lorem lorem) { _areaFaker = new Faker <Area>() .RuleFor(a => a.Id, 0) .RuleFor(a => a.Name, () => lorem.Word()); _employerFaker = new Faker <Employer>() .RuleFor(e => e.Id, 0) .RuleFor(e => e.Name, () => lorem.Sentence()); _employmentFaker = new Faker <Employment>() .RuleFor(e => e.Id, 0) .RuleFor(e => e.Name, () => lorem.Word()); _scheduleFaker = new Faker <Schedule>() .RuleFor(s => s.Id, 0) .RuleFor(s => s.Name, () => lorem.Word()); _currencyFaker = new Faker <Currency>() .RuleFor(c => c.Id, 0) .RuleFor(c => c.Name, faker => faker.Finance.Currency().Code); _skillFaker = new Faker <Skill>() .RuleFor(s => s.Id, 0) .RuleFor(s => s.Name, () => lorem.Word()); _vacancySkillFaker = new Faker <VacancySkill>() .RuleFor(vs => vs.Skill, () => _skillFaker.Generate()); _vacancyFaker = new Faker <Vacancy>() .RuleFor(v => v.Id, 0) .RuleFor(v => v.SourceId, f => f.Random.Number().ToString()) .RuleFor(v => v.SourceTypeId, 1) .RuleFor(v => v.Title, () => lorem.Sentence()) .RuleFor(v => v.Descriptions, () => lorem.Text()) .RuleFor(v => v.Responsibilities, () => lorem.Sentence()) .RuleFor(v => v.Url, f => f.Internet.Url()) .RuleFor(v => v.Area, () => _areaFaker.Generate()) .RuleFor(v => v.Currency, () => _currencyFaker.Generate()) .RuleFor(v => v.Employer, () => _employerFaker.Generate()) .RuleFor(v => v.Employment, () => _employmentFaker.Generate()) .RuleFor(v => v.Schedule, () => _scheduleFaker.Generate()) .RuleFor(v => v.VacancySkills, () => _vacancySkillFaker.Generate(5)) .RuleFor(v => v.SourceCreatedDate, f => f.Date.Past()) .RuleFor(v => v.SourceUpdatedDate, (f, v) => v.SourceCreatedDate) .RuleFor(v => v.ContentUpdatedDate, (f, v) => v.SourceCreatedDate); }
private void SetupVacancyFakers(Lorem lorem) { _vacancyFaker = new Faker <Vacancy>() .RuleFor(v => v.Id, f => f.Random.Number(1, 10)) .RuleFor(v => v.Title, f => lorem.Sentence()) .RuleFor(v => v.Descriptions, f => lorem.Text()) .RuleFor(v => v.Responsibilities, f => lorem.Sentence()) .RuleFor(v => v.Url, f => f.Internet.Url()) .RuleFor(v => v.SourceCreatedDate, f => f.Date.Past()) .RuleFor(v => v.SourceUpdatedDate, (f, v) => v.SourceCreatedDate) .RuleFor(v => v.ContentUpdatedDate, (f, v) => v.SourceCreatedDate); _sourceEmployerFaker = new Faker <SourceEmployer>() .RuleFor(e => e.Id, f => f.Random.Number(1, 10)) .RuleFor(e => e.SourceId, f => f.Random.Number(1, 10).ToString()) .RuleFor(e => e.EmployerId, f => f.Random.Number(1, 10)) .RuleFor(e => e.Url, f => f.Internet.Url()) .RuleFor(e => e.Employer, (f, e) => new Employer { Id = e.EmployerId, Name = lorem.Sentence() }); _sourceAreaFaker = new Faker <SourceArea>() .RuleFor(a => a.Id, f => f.IndexFaker) .RuleFor(a => a.AreaId, f => f.Random.Number(1, 10)) .RuleFor(a => a.SourceId, f => f.Random.Number(1, 10).ToString()) .RuleFor(a => a.Area, (f, a) => new Area { Id = a.AreaId, Name = lorem.Word() }); _sourceSubscriptionFaker = new Faker <SourceSubscription>() .RuleFor(s => s.Id, f => f.IndexFaker) .RuleFor(s => s.Name, f => lorem.Word()) .RuleFor(s => s.CreatedDate, f => DateTimeOffset.Now) .RuleFor(s => s.UpdateDate, f => DateTimeOffset.Now) .RuleFor(s => s.Parameters, f => "{}") .RuleFor(s => s.SourceType, f => new SourceType { Id = 1, Name = "Test" }); }
public void can_get_some_lorem_text() { lorem.Text().Split(" ").Length.Should().BeGreaterThan(5); }
public static string Text() => Lorem.Text();
public static string GenerateLoremText(string text) { text = text.ToLower(); if (text.StartsWith("w", StringComparison.CurrentCulture)) { text = text.Replace("w", string.Empty); if (text.Length == 0) { text = Lorem.Word(); } else { if (Int32.TryParse(text, out int number)) { text = string.Join(" ", Lorem.Words(number)); } } } if (text.StartsWith("l", StringComparison.CurrentCulture)) { text = text.Replace("l", string.Empty); if (text.Length == 0) { text = Lorem.Lines(); } else { if (Int32.TryParse(text, out int number)) { text = string.Join(" ", Lorem.Lines(number)); } } } if (text.StartsWith("p", StringComparison.CurrentCulture)) { text = text.Replace("p", string.Empty); if (text.Length == 0) { text = Lorem.Paragraph(); } else { if (Int32.TryParse(text, out int number)) { text = string.Join(" ", Lorem.Paragraph(number)); } } } if (text.StartsWith("t", StringComparison.CurrentCulture)) { text = text.Replace("t", string.Empty); if (text.Length == 0) { text = Lorem.Text(); } } if (text.StartsWith("sl", StringComparison.CurrentCulture)) { text = text.Replace("sl", string.Empty); if (text.Length == 0) { text = Lorem.Slug(); } else { if (Int32.TryParse(text, out int number)) { text = string.Join(" ", Lorem.Slug(number)); } } } return(text); }