async Task AndGivenCreatedArticlesInDatabase() { var fakerGenerator = new FakerGenerator(); var user = fakerGenerator.GetUserAccountDataFakerGenerator() .RuleFor(x => x.Id, _userId) .RuleFor(x => x.FirstName, "John") .RuleFor(x => x.LastName, "Doo") .Generate(); var otherUser = fakerGenerator.GetUserAccountDataFakerGenerator().Generate(); _context.UserAccountsData.Add(user); _context.UserAccountsData.Add(otherUser); var standardArticles = fakerGenerator.GetArticleFakerGenerator() .RuleFor(x => x.CreatorId, _userId) .RuleFor(x => x.ArticleType, ArticleType.Standard) .Generate(5); var cryptoBlogArticles = fakerGenerator.GetArticleFakerGenerator() .RuleFor(x => x.CreatorId, otherUser.Id) .RuleFor(x => x.ArticleType, ArticleType.CryptoBlog) .Generate(3); _context.Articles.AddRange(standardArticles); _context.Articles.AddRange(cryptoBlogArticles); await _context.SaveChangesAsync(); }
async Task AndGivenCreatedArticlesInDatabase() { var fakerGenerator = new FakerGenerator(); var user = fakerGenerator.GetUserAccountDataFakerGenerator().Generate(); _context.UserAccountsData.Add(user); var testedArticle = fakerGenerator.GetArticleFakerGenerator() .RuleFor(x => x.Id, _articleId) .RuleFor(x => x.CreatorId, user.Id) .Generate(); var articles = fakerGenerator.GetArticleFakerGenerator() .RuleFor(x => x.CreatorId, user.Id) .Generate(5); articles.Add(testedArticle); _context.Articles.AddRange(articles); await _context.SaveChangesAsync(); }