Beispiel #1
0
        public async Task UowAsyncInsert_MultipleBlogWithPosts_SuccessfullSave()
        {
            var blogs = BlogObjectMother.aListOfBlogsAndPosts("MultiInsert Blog");

            foreach (var blog in blogs)
            {
                Uow.GetRepository <Blog>().Insert(blog);
                await Uow.SaveChangesAsync();
            }

            var result = Uow.GetRepository <Blog>().GetFirstOrDefault(predicate: x =>
                                                                      x.Title.Contains("MultiInsert Blog"),
                                                                      include: i => i.Include(x => x.Posts));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Posts, Is.Not.Null);
        }
 private void AddObjectMothers()
 {
     db.AddRange(BlogObjectMother.aListOfBlogsAndPosts());
     db.Add(BlogObjectMother.aDefaultBlog().WithTile("ASDF").ToRepository());
 }
Beispiel #3
0
 private void AddObjectMothers()
 {
     Uow.GetRepository <Blog>().Insert(BlogObjectMother.aListOfBlogsAndPosts());
 }
        private void BuildDb()
        {
            _context.Blogs.AddRange(BlogObjectMother.aListOfBlogsAndPosts());

            _context.SaveChanges();
        }