public void ISQLExceptionConverter_gets_called_if_batch_size_enabled() { long oneId; using(var s = OpenSession()) using(var tx = s.BeginTransaction()) { var one = new One(); s.Save(one); var many = new Many { One = one }; s.Save(many); tx.Commit(); oneId = one.Id; } using(ISession s = OpenSession()) using (ITransaction tx = s.BeginTransaction()) { var one = s.Load<One>(oneId); s.Delete(one); Assert.That(() => tx.Commit(), Throws.TypeOf<ConstraintViolationException>()); } }
public void ISQLExceptionConverter_gets_called_if_batch_size_enabled() { long oneId; using(var s = OpenSession()) using(var tx = s.BeginTransaction()) { var one = new One(); s.Save(one); var many = new Many { One = one }; s.Save(many); tx.Commit(); oneId = one.Id; } using(ISession s = OpenSession()) using (ITransaction tx = s.BeginTransaction()) { var one = s.Load<One>(oneId); try { s.Delete(one); tx.Commit(); Assert.Fail("DELETE should have failed"); } catch (Exception ex) { Assert.IsInstanceOf<ConstraintViolationException>(ex); } } }
public void ISQLExceptionConverter_gets_called_if_batch_size_enabled() { long oneId; using (var s = OpenSession()) using (var tx = s.BeginTransaction()) { var one = new One(); s.Save(one); var many = new Many { One = one }; s.Save(many); tx.Commit(); oneId = one.Id; } using (ISession s = OpenSession()) using (ITransaction tx = s.BeginTransaction()) { var one = s.Load <One>(oneId); try { s.Delete(one); tx.Commit(); Assert.Fail("DELETE should have failed"); } catch (Exception ex) { Assert.IsInstanceOf <ConstraintViolationException>(ex); } } }