public void TestBookHashReviewSaveChangesWithAnotherBookTimeOk(int numReviews) { //SETUP var options = SqliteInMemory.CreateOptions <BookHashContext>(); using var context = new BookHashContext(options); context.Database.EnsureCreated(); var book1 = CreateBookWithHashReviews(numReviews); using (new TimeThings(_output, $"ADD1 BookListReview: {numReviews} entries")) context.Add(book1); var book2 = CreateBookWithHashReviews(numReviews); using (new TimeThings(_output, $"ADD2 BookListReview: {numReviews} entries")) context.Add(book2); using (new TimeThings(_output, $"Save(real): BookListReview: {numReviews} entries")) { context.SaveChanges(); } using (new TimeThings(_output, $"Save nothing: BookListReview: {numReviews} entries")) { context.SaveChanges(); } }
public void TestBookHashReviewQueryTimeOk(int numReviews) { //SETUP var options = SqliteInMemory.CreateOptions <BookHashContext>(); using var context = new BookHashContext(options); context.Database.EnsureCreated(); context.Add(CreateBookWithHashReviews(numReviews)); context.SaveChanges(); context.ChangeTracker.Clear(); using (new TimeThings(_output, $"1: BookHashReview: {numReviews} entries")) { var book = context.Books .Include(x => x.Reviews) .Single(); book.Reviews.Count.ShouldEqual(numReviews); } using (new TimeThings(_output, $"2: BookHashReview: {numReviews} entries")) { var book = context.Books .Include(x => x.Reviews) .Single(); book.Reviews.Count.ShouldEqual(numReviews); } }
public void TestBookHashContextOk() { //SETUP var options = SqliteInMemory.CreateOptions <BookHashContext>(); using var context = new BookHashContext(options); context.Database.EnsureCreated(); context.Add(CreateBookWithHashReviews(2)); context.SaveChanges(); context.ChangeTracker.Clear(); var book = context.Books .Include(x => x.Reviews) .Single(); //VERIFY book.Reviews.Count.ShouldEqual(2); }
public void TestBookHashReviewSaveChangesTimeOk(int numReviews) { //SETUP var options = SqliteInMemory.CreateOptions <BookHashContext>(); using var context = new BookHashContext(options); context.Database.EnsureCreated(); var book = CreateBookWithHashReviews(numReviews); using (new TimeThings(_output, $"ADD: BookHashReview: {numReviews} entries")) context.Add(book); context.SaveChanges(); using (new TimeThings(_output, $"1: BookHashReview: {numReviews} entries")) { context.SaveChanges(); } using (new TimeThings(_output, $"2: BookHashReview: {numReviews} entries")) { context.SaveChanges(); } }