public void PostInsert_autoflush_without_flush_adds_to_solr() { var entity = new Entity {Description = "pepe"}; using (var session = sessionFactory.OpenSession()) { session.Save(entity); } mockSolr.AssertWasCalled(x => x.Add(entity, null), o => o.Repeat.Once().Return(null)); }
public void PostInsert_manual_flush_without_flush_doesnt_add_to_solr() { var entity = new Entity {Description = "pepe"}; mockSolr.addDocParams &= x => x.Expect(0); using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); } }
public void PostInsert_with_commit_adds_to_solr() { var entity = new Entity(); mockSolr.addDocParams &= x => x.Expect(1); using (var session = sessionFactory.OpenSession()) { using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Commit(); } } }
public void PostInsert_manual_flush_adds_to_solr() { var entity = new Entity {Description = "pepe"}; using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); session.Flush(); } mockSolr.AssertWasCalled(x => x.Add(entity), o => o.Repeat.Once().Return(null)); }
public void Add_includes_parameters_when_configured() { var entity = new Entity { Description = "pepe" }; using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); session.Flush(); } mockSolr.AssertWasCalled(x => x.Add(entity, addParameters), o => o.Repeat.Once().Return(null)); }
public void PostInsert_autoflush_without_flush_adds_to_solr() { var entity = new Entity {Description = "pepe"}; mockSolr.addDocParams += (e, p) => { Assert.AreSame(entity, e); Assert.IsNull(p); return null; }; mockSolr.addDocParams &= x => x.Expect(1); using (var session = sessionFactory.OpenSession()) { session.Save(entity); } }
public void PostInsert_autoflush_without_flush_adds_to_solr() { var entity = new Entity {Description = "pepe"}; mockSolr.Expect(x => x.Add(entity)) .Repeat.Once() .Return(null); mockSolr.Replay(); using (var session = sessionFactory.OpenSession()) { session.Save(entity); } mockSolr.VerifyAllExpectations(); }
public void PostInsert_manual_flush_adds_to_solr() { var entity = new Entity {Description = "pepe"}; mockSolr.addDocParams += (e, p) => { Assert.AreSame(entity, e); Assert.IsNull(p); return null; }; using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); session.Flush(); } }
public void Add_includes_parameters_when_configured() { var entity = new Entity { Description = "pepe" }; mockSolr.addDocParams += (doc, param) => { Assert.AreSame(entity, doc); Assert.AreSame(addParameters, param); return null; }; mockSolr.addDocParams &= x => x.Expect(1); using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); session.Flush(); } }
public void Insert_with_multiple_transactions2() { var entity = new Entity(); using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Commit; using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Commit(); } using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Rollback(); } } mockSolr.AssertWasCalled(x => x.Add(entity, null), o => o.Repeat.Once().Return(null)); }
public void Insert_with_multiple_transactions2() { var entity = new Entity(); mockSolr.Expect(x => x.Add(entity)) .Repeat.Once() .Return(null); mockSolr.Replay(); using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Commit; using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Commit(); } using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Rollback(); } } mockSolr.VerifyAllExpectations(); }
public void PostInsert_without_commit_doesnt_add_to_solr() { var entity = new Entity(); using (var session = sessionFactory.OpenSession()) { using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Rollback(); } } mockSolr.AssertWasNotCalled(x => x.Add(entity, null)); }
public void PostInsert_without_commit_doesnt_add_to_solr() { var entity = new Entity(); mockSolr.Expect(x => x.Add(entity)) .Repeat.Never() .Return(null); mockSolr.Replay(); using (var session = sessionFactory.OpenSession()) { using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Rollback(); } } mockSolr.VerifyAllExpectations(); }
public void PostInsert_manual_flush_without_flush_doesnt_add_to_solr() { var entity = new Entity {Description = "pepe"}; mockSolr.Expect(x => x.Add(entity)) .Repeat.Never() .Return(null); mockSolr.Replay(); using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); } mockSolr.VerifyAllExpectations(); }
public void PostInsert_manual_flush_without_flush_doesnt_add_to_solr() { var entity = new Entity {Description = "pepe"}; using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Never; session.Save(entity); } mockSolr.AssertWasNotCalled(x => x.Add(entity, null)); }
public void Insert_with_multiple_transactions() { var entity = new Entity(); mockSolr.addDocParams &= x => x.Expect(1); using (var session = sessionFactory.OpenSession()) { session.FlushMode = FlushMode.Commit; using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Rollback(); } using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Commit(); } } }
public void PostInsert_with_commit_adds_to_solr() { var entity = new Entity(); using (var session = sessionFactory.OpenSession()) { using (var tx = session.BeginTransaction()) { session.Save(entity); tx.Commit(); } } mockSolr.AssertWasCalled(x => x.Add(entity, null), o => o.Repeat.Once().Return(null)); }