Exemple #1
0
        public virtual void Test1()
        {
            NeoDatis.Odb.ODB odb = Open("cyclic.neodatis");
            NeoDatis.Odb.Objects <Country2> l = odb.GetObjects <Country2>(true);
            Country2 country = l.GetFirst();

            AssertEquals("Brasil0", country.GetName());
            AssertEquals("Brasilia0", country.GetCapital().GetName());
            odb.Close();
        }
Exemple #2
0
        public virtual void TestUniqueInstance1()
        {
            NeoDatis.Odb.ODB                odb       = Open("cyclic.neodatis");
            NeoDatis.Odb.Objects <City>     cities    = odb.GetObjects <City>(true);
            NeoDatis.Odb.Objects <Country2> countries = odb.GetObjects <Country2>(true);
            Country2 country = countries.GetFirst();
            City     city    = cities.GetFirst();

            AssertTrue(country == city.GetCountry());
            AssertTrue(city == country.GetCities()[0]);
            AssertTrue(city == country.GetCapital());
            odb.Close();
        }
Exemple #3
0
        public virtual void Test15()
        {
            Println("-------------------");
            // LogUtil.logOn(ObjectWriter.LOG_ID, true);
            // LogUtil.logOn(ObjectReader.LOG_ID, true);
            NeoDatis.Odb.ODB odb = Open("cyclic.neodatis");
            NeoDatis.Odb.Objects <Country2> l = odb.GetObjects < Country2(true);
            Country2 country = l.GetFirst();
            City     city    = country.GetCapital();

            city.SetName("rio de janeiro");
            country.SetCapital(city);
            odb.Store(country);
            odb.Close();
            odb     = Open("cyclic.neodatis");
            l       = odb.GetObjects <Country2>(true);
            country = l.GetFirst();
            AssertEquals("rio de janeiro", country.GetCapital().GetName());
            l = odb.GetObjects <City>(new CriteriaQuery(Where.Equal("name", "rio de janeiro")));
            AssertEquals(1, l.Count);
            l = odb.GetObjects <City>(new CriteriaQuery());
            AssertEquals(1, l.Count);
            odb.Close();
        }
Exemple #4
0
        public virtual void Test2()
        {
            NeoDatis.Odb.ODB odb = Open("cyclic.neodatis");
            NeoDatis.Odb.Objects <Country2> l = odb.GetObjects <Country2>(true);
            Country2 country = l.GetFirst();
            City     city    = new City("rio de janeiro");

            country.SetCapital(city);
            odb.Store(country);
            odb.Close();
            odb     = Open("cyclic.neodatis");
            l       = odb.GetObjects <Country2>(true);
            country = (Country2)l.GetFirst();
            AssertEquals("rio de janeiro", country.GetCapital().GetName());
            l = odb.GetObjects <City>(new CriteriaQuery(Where.Equal("name", "rio de janeiro")));
            AssertEquals(1, l.Count);
            l = odb.GetObjects <City>(new CriteriaQuery());
            AssertEquals(2, l.Count);
            odb.Close();
        }