public void CanDelete() { var user = new User() { Name = "Harry" }; var dbSession = _database.OpenSession(); dbSession.Store(user); Assert.Null(_database.OpenSession().Get<User>(user.PieId())); dbSession.Commit(); Assert.NotNull(_database.OpenSession().Get<User>(user.PieId())); dbSession.Remove(user); dbSession.Commit(); Assert.Null(_database.OpenSession().Get<User>(user.PieId())); }
public void CanAutomaticallyAssignAnId() { var user = new User() { Name = "Harry" }; var dbSession = _database.OpenSession(); dbSession.Store(user); var loadedUser = dbSession.Get<User>(user.PieId()); Assert.AreEqual("Harry", loadedUser.Name); }
public void CanDelete() { var user = new User() { Name = "Harry" }; var dbSession = _database.OpenSession(); dbSession.Store(user); Assert.Null(_database.OpenSession().Get <User>(user.PieId())); dbSession.Commit(); Assert.NotNull(_database.OpenSession().Get <User>(user.PieId())); dbSession.Remove(user); dbSession.Commit(); Assert.Null(_database.OpenSession().Get <User>(user.PieId())); }
public void CanSearch() { var user = new User() { Name = "Harry" }; dbSession.Store(user); dbSession.Commit(); var user2 = this.indexer.Query<User>(dbSession, u => u.Name == "Harry").Single(); Assert.AreEqual("Harry", user2.Name); Assert.AreEqual(user.PieId(), user2.PieId(), "If these are different, user2 has not been loaded from the database (it has just been rebuilt by the lucene search)"); }
public void CanAutomaticallyAssignAnId() { var user = new User() { Name = "Harry" }; var dbSession = _database.OpenSession(); dbSession.Store(user); var loadedUser = dbSession.Get <User>(user.PieId()); Assert.AreEqual("Harry", loadedUser.Name); }
public void CanSearch() { var user = new User() { Name = "Harry" }; dbSession.Store(user); dbSession.Commit(); var user2 = this.indexer.Query <User>(dbSession, u => u.Name == "Harry").Single(); Assert.AreEqual("Harry", user2.Name); Assert.AreEqual(user.PieId(), user2.PieId(), "If these are different, user2 has not been loaded from the database (it has just been rebuilt by the lucene search)"); }