/// <exception cref="System.Exception"></exception> public virtual void TestList3() { DeleteBase("list3.neodatis"); NeoDatis.Odb.ODB odb = Open("list3.neodatis"); long nb = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof( MyObject))); MyList l1 = new MyList (); l1.Add("object1"); l1.Add("object2"); MyObject myObject = new MyObject("o1", l1); odb.Store(myObject); odb.Close(); NeoDatis.Odb.ODB odb2 = Open("list3.neodatis"); NeoDatis.Odb.Impl.Core.Query.List.Objects<MyObject> l = odb2.GetObjects<MyObject>(true); AssertEquals(nb + 1, l.Count); odb2.Close(); DeleteBase("list3.neodatis"); }
/// <summary>Test update object list.</summary> /// <remarks>Test update object list. adding 2 elements</remarks> /// <exception cref="System.Exception"></exception> public virtual void TestList4Update2() { DeleteBase("list4.neodatis"); NeoDatis.Odb.ODB odb = Open("list4.neodatis"); long nb = odb.Count(new CriteriaQuery(typeof( MyObject))); MyList l1 = new MyList (); l1.Add("object1"); l1.Add("object2"); MyObject myObject = new MyObject("o1", l1); odb.Store(myObject); odb.Close(); NeoDatis.Odb.ODB odb2 = Open("list4.neodatis"); NeoDatis.Odb.Objects<MyObject> l = odb2.GetObjects<MyObject>(true); MyObject mo = (MyObject )l.GetFirst(); mo.GetList().Add("object3"); mo.GetList().Add("object4"); odb2.Store(mo); odb2.Close(); odb2 = Open("list4.neodatis"); l = odb2.GetObjects<MyObject>(true); AssertEquals(nb + 1, l.Count); MyObject mo2 = l.GetFirst(); AssertEquals(4, mo2.GetList().Count); AssertEquals("object1", mo2.GetList()[0]); AssertEquals("object2", mo2.GetList()[1]); AssertEquals("object3", mo2.GetList()[2]); AssertEquals("object4", mo2.GetList()[3]); odb2.Close(); DeleteBase("list4.neodatis"); }