Beispiel #1
0
        /// <summary>
        /// Génère un certain nombre d'utilisateurs au hasard
        /// </summary>
        /// <param name="howMany"></param>
        /// <returns></returns>
        public List <User> Generate(int howMany)
        {
            var testUser = new Faker <User>().StrictMode(true)
                           .RuleFor(u => u.UserName, f => f.Name.FirstName(Bogus.DataSets.Name.Gender.Male))
                           .RuleFor(u => u.Books, f => CustomAutoMapper.MapLists <Book, User.Book>(_fakeBooksService.Generate(6)))
                           .RuleFor(u => u.Suggestions, f => CustomAutoMapper.MapLists <Suggestion, User.Suggestion>(_fakeSuggestionsService.Generate(6)))
                           .RuleFor(u => u.FavoriteCategories, f => BooksSamples.GetCategories(3));

            return(testUser.Generate(howMany));
        }
Beispiel #2
0
        public List <Author> Generate(int howMany)
        {
            var books       = _booksService.Generate(7);
            var authorBooks = CustomAutoMapper.MapLists <Book, Author.Book>(books);

            var bookstest = new Faker <Author>().StrictMode(true)
                            .RuleFor(a => a.FirstName, f => f.Name.FirstName())
                            .RuleFor(a => a.LastName, f => f.Name.LastName())
                            .RuleFor(a => a.Books, f => authorBooks);

            var authors = bookstest.Generate(howMany);

            return(authors);
        }