Пример #1
0
 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));
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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();
         }
     }
 } 
Пример #4
0
 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));
 }
Пример #6
0
 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);
     }
 }
Пример #7
0
 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();
 }
Пример #8
0
 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();
     }
 }
Пример #10
0
 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));
 }
Пример #11
0
 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();
 }
Пример #12
0
 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));
 }
Пример #13
0
 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();
 }
Пример #14
0
 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();
 }
Пример #15
0
 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));
 }
Пример #16
0
 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();
         }
     }
 }
Пример #17
0
 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));
 }