public void NestedTransactionsUniqueKey() { using (SakilaDb context = new SakilaDb()) { var store = new store { manager_staff_id = 1 }; context.stores.Add(store); for (int i = 0; i < 10; i++) { Assert.Throws <DbUpdateException>(() => context.SaveChanges()); } } }
public void DisposeNestedTransactions() { using (SakilaDb context = new SakilaDb()) { using (var trans = context.Database.BeginTransaction()) { Assert.Throws <MySqlException>(() => context.Database.ExecuteSqlCommand("update abc")); } } // new second transaction using (SakilaDb context = new SakilaDb()) { using (var trans = context.Database.BeginTransaction()) { Assert.Throws <MySqlException>(() => context.Database.ExecuteSqlCommand("update abc")); } } }