Пример #1
0
        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()));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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()));
        }
Пример #4
0
        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)");
        }
Пример #5
0
        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);
        }
Пример #6
0
        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)");
        }