private async Task <int> WriteToCosmosThreeWays(int i)
        {
            int numToAdd = 100;

            var directBooks = BookTestData.CreateDummyBooks(numToAdd).ToList()
                              .Select(x => new DirectCosmosBook(i++, x)).ToList();

            //ATTEMPT
            using (new TimeThings(_output, "Direct", numToAdd))
            {
                foreach (var book in directBooks)
                {
                    var response = await _cosmosContainer.CreateItemAsync(book);
                }
            }

            using (new TimeThings(_output, "SQL", numToAdd))
            {
                _sqlContext.AddRange(BookTestData.CreateDummyBooks(numToAdd));
                await _sqlContext.SaveChangesAsync();
            }

            var cBooks = BookTestData.CreateDummyBooks(numToAdd).AsQueryable()
                         .MapBookToCosmosBook().ToList();

            cBooks.ForEach(x => x.BookId = i++);
            using (new TimeThings(_output, "Via EfCore", numToAdd))
            {
                _cosmosContext.AddRange(cBooks);
                await _cosmosContext.SaveChangesAsync();
            }

            return(i);
        }
        public void TestUsingTransactionToRollBackChanges()
        {
            //SETUP
            var builder = new                                        //#A
                          DbContextOptionsBuilder <BookDbContext>(); //#A

            builder.UseSqlServer(_connectionString);                 //#A
            using var context =                                      //#A
                                new BookDbContext(builder.Options);  //#A


            using var transaction =                                      //#B
                                    context.Database.BeginTransaction(); //#B

            //ATTEMPT
            var newBooks = BookTestData           //#C
                           .CreateDummyBooks(10); //#C

            context.AddRange(newBooks);           //#C
            context.SaveChanges();                //#C

            //VERIFY
            context.Books.Count().ShouldEqual(4 + 10); //#D
        } //#E