public void ShouldThrowExceptionWhenTryingToSaveInherited1WithDuplicateName() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var e1 = new Inherited1 { Name = "Bob" }; session.Save(e1); Assert.That(() => { transaction.Commit(); }, Throws.Exception); } }
public void ShouldThrowExceptionWhenTryingToSaveInherited1WithDuplicateName() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var e1 = new Inherited1 { Name = "Bob" }; session.Save(e1); Assert.That(() => { transaction.Commit(); }, Throws.Exception); } }
public async Task ShouldThrowExceptionWhenTryingToSaveInherited1WithDuplicateNameAsync() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var e1 = new Inherited1 { Name = "Bob" }; await(session.SaveAsync(e1)); // Do not use bare Throws.Exception due to https://github.com/nunit/nunit/issues/1899 Assert.That(() => { return(transaction.CommitAsync()); }, Throws.InstanceOf <Exception>()); } }
protected override void OnSetUp() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var e1 = new Inherited1 { Name = "Bob" }; session.Save(e1); var e2 = new Inherited2 { Name = "Sally" }; session.Save(e2); session.Flush(); transaction.Commit(); } }
protected override void OnSetUp() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var e1 = new Inherited1 { Name = "Bob" }; session.Save(e1); var e2 = new Inherited2 { Name = "Sally" }; session.Save(e2); session.Flush(); transaction.Commit(); } }