private void CleanupBookPostgreSqlDb(Guid bookId)
 {
     using (var db = new BooksSqlDbContext())
     {
         var addedBook = db.Books.Find(bookId);
         db.Books.Remove(addedBook);
         db.SaveChanges();
     }
 }
Exemple #2
0
        public void AddBookAddedTest()
        {
            var bookId = Guid.NewGuid();

            using (var db = new BooksSqlDbContext())
            {
                var book = new Book
                {
                    Id     = bookId,
                    Title  = "test",
                    Author = "test",
                    Path   = "test"
                };

                db.Books.Add(book);
                db.SaveChanges();
                var addedBook = db.Books.Find(bookId);
                Assert.Equal(bookId, addedBook.Id);
            }

            CleanupAddedBook(bookId);
        }
 public void Commit()
 {
     db.SaveChanges();
 }
Exemple #4
0
 public BookSagaEvent Add(BookSagaEvent book)
 {
     dbContext.Add(book);
     dbContext.SaveChanges();
     return(book);
 }
 public Book Add(Book book)
 {
     dbContext.Add(book);
     dbContext.SaveChanges();
     return(book);
 }