Пример #1
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestList1()
        {
            DeleteBase("list1.neodatis");
            NeoDatis.Odb.ODB odb = Open("list1.neodatis");
            long             nb  = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof(
                                                                                                         PlayerWithList)));
            PlayerWithList player = new PlayerWithList
                                        ("kiko");

            player.AddGame("volley-ball");
            player.AddGame("squash");
            player.AddGame("tennis");
            player.AddGame("ping-pong");
            odb.Store(player);
            odb.Close();
            NeoDatis.Odb.ODB odb2 = Open("list1.neodatis");
            NeoDatis.Odb.Objects <PlayerWithList> l = odb2.GetObjects <PlayerWithList>(true);
            Println(l);
            AssertEquals(nb + 1, l.Count);
            // gets last player
            PlayerWithList player2 = (PlayerWithList)l.GetFirst();

            AssertEquals(player.ToString(), player2.ToString());
            odb2.Close();
            DeleteBase("list1.neodatis");
        }
Пример #2
0
        public virtual void TestList1()
        {
            DeleteBase("list1.ndb");
            var odb    = Open("list1.ndb");
            var nb     = odb.Query <PlayerWithList>().Count();
            var player = new PlayerWithList("kiko");

            player.AddGame("volley-ball");
            player.AddGame("squash");
            player.AddGame("tennis");
            player.AddGame("ping-pong");
            odb.Store(player);
            odb.Close();
            var odb2  = Open("list1.ndb");
            var query = odb2.Query <PlayerWithList>();
            var l     = query.Execute <PlayerWithList>(true);

            Println(l);
            AssertEquals(nb + 1, l.Count);
            // gets last player
            var player2 = l.GetFirst();

            AssertEquals(player.ToString(), player2.ToString());
            odb2.Close();
            DeleteBase("list1.ndb");
        }