コード例 #1
0
        public virtual void Test3()
		{
			// LogUtil.objectReaderOn(true);
			DeleteBase("map-with-collections");
			NeoDatis.Odb.ODB odb = null;
			odb = Open("map-with-collections");
			MyMapObject o = new MyMapObject("test");
			System.Collections.Generic.IList<MyMapObject> c = new System.Collections.Generic.List<MyMapObject>();
			c.Add(o);
			Function f1 = new Function("function1");
			o.GetMap().Add("a", c);
			int size = 1;
			for (int i = 0; i < size; i++)
			{
				o.GetMap().Add("A" + i, f1);
			}
			o.GetMap().Add("c", f1);
			Println("RealMap" + o.GetMap());
			odb.Store(o);
			odb.Close();
			odb = Open("map-with-collections");
            NeoDatis.Odb.Objects<MyMapObject> os = odb.GetObjects<MyMapObject>();
			NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject mmo = (NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
				)os.GetFirst();
			odb.Close();
			DeleteBase("map-with-collections");
			AssertEquals(o.GetName(), mmo.GetName());
			AssertEquals(size + 2, mmo.GetMap().Count);
			AssertEquals(mmo, ((System.Collections.ICollection)mmo.GetMap()["a"]).GetEnumerator
				().Current);
			AssertEquals("function1", mmo.GetMap()["c"].ToString());
		}
コード例 #2
0
        public virtual void Test3()
        {
            // LogUtil.objectReaderOn(true);
            DeleteBase("map-with-collections");
            NeoDatis.Odb.ODB odb = null;
            odb = Open("map-with-collections");
            MyMapObject o = new MyMapObject("test");

            System.Collections.Generic.IList <MyMapObject> c = new System.Collections.Generic.List <MyMapObject>();
            c.Add(o);
            Function f1 = new Function("function1");

            o.GetMap().Add("a", c);
            int size = 1;

            for (int i = 0; i < size; i++)
            {
                o.GetMap().Add("A" + i, f1);
            }
            o.GetMap().Add("c", f1);
            Println("RealMap" + o.GetMap());
            odb.Store(o);
            odb.Close();
            odb = Open("map-with-collections");
            NeoDatis.Odb.Objects <MyMapObject> os = odb.GetObjects <MyMapObject>();
            NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject mmo = (NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
                                                                    )os.GetFirst();
            odb.Close();
            DeleteBase("map-with-collections");
            AssertEquals(o.GetName(), mmo.GetName());
            AssertEquals(size + 2, mmo.GetMap().Count);
            AssertEquals(mmo, ((System.Collections.ICollection)mmo.GetMap()["a"]).GetEnumerator
                             ().Current);
            AssertEquals("function1", mmo.GetMap()["c"].ToString());
        }
コード例 #3
0
        public virtual void Test2()
        {
            DeleteBase("map-with-collections");
            NeoDatis.Odb.ODB odb = null;
            odb = Open("map-with-collections");
            NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject o = new NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
                                                                     ("test");
            System.Collections.Generic.IList <MyMapObject> c = new System.Collections.Generic.List <MyMapObject>();
            c.Add(o);
            o.GetMap().Add("c", c);
            odb.Store(o);
            odb.Close();
            odb = Open("map-with-collections");
            NeoDatis.Odb.Objects <MyMapObject> os = odb.GetObjects <MyMapObject>();
            MyMapObject mmo = os.GetFirst();

            odb.Close();
            DeleteBase("map-with-collections");
            AssertEquals(o.GetName(), mmo.GetName());
            AssertEquals(o.GetMap().Count, mmo.GetMap().Count);
            System.Collections.ICollection c1 = (System.Collections.ICollection)o.GetMap()["c"
                                                ];
            System.Collections.ICollection c2 = (System.Collections.ICollection)mmo.GetMap()[
                "c"];
            AssertEquals(c1.Count, c2.Count);
            AssertEquals(mmo, c2.GetEnumerator().Current);
        }
コード例 #4
0
        public virtual void Test1()
        {
            DeleteBase("map-with-collections");
            NeoDatis.Odb.ODB odb = null;
            odb = Open("map-with-collections");
            NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject o = new NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
                                                                     ("test");
            System.Collections.Generic.IList <string> c = new System.Collections.Generic.List <string>();
            c.Add("ola");
            o.GetMap().Add("c", c);
            odb.Store(o);
            odb.Close();
            odb = Open("map-with-collections");
            NeoDatis.Odb.Objects <MyMapObject> os = odb.GetObjects <MyMapObject>();
            MyMapObject mmo = os.GetFirst();

            odb.Close();
            DeleteBase("map-with-collections");
            AssertEquals(o.GetName(), mmo.GetName());
            AssertEquals(o.GetMap().Count, mmo.GetMap().Count);
            AssertEquals(o.GetMap()["c"], mmo.GetMap()["c"]);
        }