public void InsertBatchInvoiceWithInvoiceForEachExistingJournal()
        {
            using (var db = new InvoiceContext())
            {
                for (int i = 0; i < 10; i++)
                {
                    db.Journals.Add(new Journal()
                    {
                        Id = Guid.NewGuid()
                    });
                }
                db.SaveChanges();

                var batchInvoice = new BatchInvoice {
                    Id = Guid.NewGuid()
                };

                foreach (var journal in db.Journals.ToList())
                {
                    var invoice = new Invoice()
                    {
                        Id = Guid.NewGuid()
                    };
                    invoice.Journals.Add(new InvoiceItem()
                    {
                        JournalId = journal.Id
                    });
                    batchInvoice.Invoices.Add(new BatchInvoiceItem()
                    {
                        Id = Guid.NewGuid(), Invoice = invoice
                    });
                }

                var req = new BulkInsertRequest <BatchInvoice>
                {
                    Entities = new[] { batchInvoice }.ToList(),
                    AllowNotNullSelfReferences = AllowNotNullSelfReferences.No,
                    SortUsingClusteredIndex    = true,
                    EnableRecursiveInsert      = EnableRecursiveInsert.Yes
                };
                var response = db.BulkInsertAll(req);

                Assert.AreEqual(1, db.BatchInvoices.ToArray().Count());
                Assert.AreEqual(10, db.BatchInvoiceItems.ToArray().Count());
                Assert.AreEqual(10, db.Invoices.ToArray().Count());
                Assert.AreEqual(10, db.InvoiceItems.ToArray().Count());
            }
        }