/// <summary> /// Создает новый экземпляр сгенерированных данных о сериях /// </summary> public FakeEpisodeEntities() { var loremRu = new Bogus.DataSets.Lorem("ru"); EpisodeFaker = new Faker <EpisodeEntity>() .RuleFor(m => m.Id, f => f.IndexFaker) .RuleFor(m => m.TitleRu, f => string.Join(" ", loremRu.Words(2))) .RuleFor(m => m.TitleEn, f => string.Join(" ", f.Lorem.Words(2))) .RuleFor(m => m.DurationInMinutes, f => f.Random.Double(15, 60)) .RuleFor(m => m.UrlForEpisodeSource, f => f.Internet.Url()); EpisodeEntities = new List <EpisodeEntity>(); }
/// <summary> /// Создает новый экземпляр сгенерированных данных о сериалах /// </summary> /// <param name="personsCount">Необходимое количество сгенерированных людей</param> /// <param name="genresCount">Необходимое количество сгенерированных жанров видео</param> /// <param name="tvSerialsCount">Необходимое количество сгенерированных сериалах</param> public FakeTvSeriasEntities( int tvSeriasCount, FakePersonEntities personEntities, FakeGenreEntities genreEntities, FakeSeasonEntities seasonEntities, FakeEpisodeEntities episodeEntities) { var loremRu = new Bogus.DataSets.Lorem("ru"); TvSeriasFaker = new Faker <TvSeriasEntity>() .RuleFor(m => m.Id, f => f.IndexFaker) .RuleFor(m => m.TitleEn, f => string.Join(" ", f.Lorem.Words(2))) .RuleFor(m => m.TitleEn, f => string.Join(" ", loremRu.Words(2))) .RuleFor(m => m.PosterImageUrl, f => f.Internet.Url()) .RuleFor(m => m.LostfilmRate, f => f.Random.Double(1, 10)) .RuleFor(m => m.RateImDb, f => f.Random.Double(1, 10)) .RuleFor(m => m.UrlToOfficialSite, f => f.Internet.Url()) .RuleFor(m => m.Summary, f => f.Lorem.Text()) .RuleFor(m => m.ListPerson, f => f.PickRandom(personEntities.PersonEntities, 30).ToList()) .RuleFor(m => m.ListGenreEntity, f => f.PickRandom(genreEntities.GenreEntities, 3).ToList()) .RuleFor(m => m.ListSeasons, f => seasonEntities.Generate( f.Random.Number(1, 13), f.Date.Between(new DateTime(1995, 1, 1), new DateTime(2020, 12, 31)), episodeEntities)); TvSeriasEntities = TvSeriasFaker.Generate(tvSeriasCount); foreach (var tvSeriasEntity in TvSeriasEntities) { foreach (var seasonEntity in tvSeriasEntity.ListSeasons) { seasonEntity.TvSeriesId = tvSeriasEntity.Id; seasonEntity.TvSeries = tvSeriasEntity; } foreach (var genreEntity in tvSeriasEntity.ListGenreEntity) { genreEntity.ListTvSerias.Add(tvSeriasEntity); } foreach (var personEntity in tvSeriasEntity.ListPerson) { personEntity.ListTvSerias.Add(tvSeriasEntity); } } }
public IEnumerable <Application> GetApplications() { var applicationId = 1; var applicationData = new Bogus.DataSets.Lorem("en"); var applicationStatus = new[] { "New", "App Team Engaged", "Analyzed", "Disposition Initiated", "Dispositioned", "Deployed" }; Randomizer.Seed = new Random(123789); var applicationGenerator = new Faker <Application>() .RuleFor(app => app.Id, mck => $"CA {applicationId++}") .RuleFor(app => app.Name, mck => String.Join(" ", applicationData.Words(4))) .RuleFor(app => app.RemedyId, mck => $"OI-{Guid.NewGuid()}") .RuleFor(app => app.Description, mck => applicationData.Sentence(8)) .RuleFor(app => app.ShortAppId, mck => applicationData.Word()) .RuleFor(app => app.Status, mck => mck.PickRandom(applicationStatus)) .RuleFor(app => app.InstallDate, mck => mck.Date.Past(5).Date) .RuleFor(app => app.IsHighRisk, mck => mck.Random.Bool()); return(applicationGenerator.Generate(100)); }