public void TestAddSaveChangesExceptionHandlerButStillFailsOnOtherDbExceptions() { //SETUP var options = SqliteInMemory.CreateOptions <SqlEventsDbContext>(); var config = new GenericEventRunnerConfig(); config.RegisterSaveChangesExceptionHandler <SqlEventsDbContext>(BookWithEventsConcurrencyHandler.HandleCacheValuesConcurrency); var context = options.CreateDbWithDiForHandlers <SqlEventsDbContext, ReviewAddedHandler>(config: config); context.Database.EnsureCreated(); var review = new ReviewWithEvents(1, "hello", "Me", Guid.NewGuid()); context.Add(review); //ATTEMPT var ex = Assert.Throws <DbUpdateException>(() => context.SaveChanges()); //VERIFY ex.InnerException.Message.ShouldEqual("SQLite Error 19: 'FOREIGN KEY constraint failed'."); }
public BookReviewRemovedEvent(ReviewWithEvents reviewRemoved, BookWithEvents book, Action <int, double> updateReviewCachedValues) { ReviewRemoved = reviewRemoved; Book = book; UpdateReviewCachedValues = updateReviewCachedValues; }