Exemplo n.º 1
0
 public virtual void Test8RollbackDeleteAndStore()
 {
     DeleteBase("rollback.neodatis");
     NeoDatis.Odb.ODB odb = Open("rollback.neodatis", "u1", "p1");
     odb.Store(new Function("f1"));
     odb.Store(new Function("f2"));
     odb.Store(new Function("f3"));
     odb.Close();
     odb = Open("rollback.neodatis", "u1", "p1");
     NeoDatis.Odb.Objects <Function> objects = odb.GetObjects <Function>();
     while (objects.HasNext())
     {
         Function f = (Function)objects
                      .Next();
         f.SetName(OdbString.Substring(f.GetName(), 1));
         odb.Store(f);
     }
     objects.Reset();
     while (objects.HasNext())
     {
         odb.Delete(objects.Next());
     }
     for (int i = 0; i < 500; i++)
     {
         odb.Store(new Function("f3 - " + i));
     }
     odb.Rollback();
     odb.Close();
     odb = Open("rollback.neodatis", "u1", "p1");
     AssertEquals(3, odb.GetObjects <Function>().Count
                  );
     odb.Close();
 }
Exemplo n.º 2
0
        public virtual void Test9subString()
        {
            string s  = "NeoDatis ODB - The open source object database";
            string s1 = OdbString.Substring(s, 0, s.Length);
            string s2 = OdbString.Substring(s, 0, s.Length);

            AssertEquals(s1, s2);
        }
Exemplo n.º 3
0
        public virtual void Test8subString()
        {
            string s = "NeoDatis ODB - The open source object database";

            for (int i = 0; i < 10; i++)
            {
                string s1 = OdbString.Substring(s, i, i + 15);
                string s2 = OdbString.Substring(s, i, i + 15);
                AssertEquals(s1, s2);
            }
        }
Exemplo n.º 4
0
        public virtual void Test()
        {
            string s  = "olivier";
            string ss = OdbString.Substring(s, 0, 1);

            AssertEquals(1, ss.Length);
            ss = OdbString.Substring(s, 0, 2);
            AssertEquals(2, ss.Length);
            System.Collections.Generic.IList <object> l = new System.Collections.Generic.List <object>();
            l.Add("s1");
            l.Add("s2");
            l.Add("s3");
            l.Add("s4");
            l.Add("s5");
            AssertEquals(1, NeoDatisCollectionUtil.SublistGeneric(l, 0, 1).Count);
            AssertEquals(2, NeoDatisCollectionUtil.SublistGeneric(l, 0, 2).Count);
            AssertEquals(3, NeoDatisCollectionUtil.SublistGeneric(l, 0, 3).Count);
        }
Exemplo n.º 5
0
        public virtual void Test()
        {
            string s  = "olivier";
            string ss = OdbString.Substring(s, 0, 1);

            AssertEquals(1, ss.Length);
            ss = OdbString.Substring(s, 0, 2);
            AssertEquals(2, ss.Length);
            System.Collections.Generic.IList <string> l = new System.Collections.Generic.List <
                string>();
            l.Add("s1");
            l.Add("s2");
            l.Add("s3");
            l.Add("s4");
            l.Add("s5");
            AssertEquals(1, l.SubList(0, 1).Count);
            AssertEquals(2, l.SubList(0, 2).Count);
            AssertEquals(3, l.SubList(0, 3).Count);
        }
Exemplo n.º 6
0
 public virtual void Test7Update()
 {
     DeleteBase("rollback.neodatis");
     NeoDatis.Odb.ODB odb = Open("rollback.neodatis", "u1", "p1");
     odb.Store(new Function("1function"));
     odb.Store(new Function("2function"));
     odb.Store(new Function("3function"));
     odb.Close();
     odb = Open("rollback.neodatis", "u1", "p1");
     NeoDatis.Odb.Objects <Function> objects = odb.GetObjects <Function>();
     while (objects.HasNext())
     {
         Function f = (Function)objects
                      .Next();
         f.SetName(OdbString.Substring(f.GetName(), 1));
         odb.Store(f);
     }
     odb.Rollback();
     odb.Close();
     odb = Open("rollback.neodatis", "u1", "p1");
     AssertEquals(3, odb.GetObjects <Function>().Count
                  );
     odb.Close();
 }