Beispiel #1
0
        public virtual void TestArray3()
        {
            IOdb odb  = null;
            var  size = 50;

            try
            {
                DeleteBase("array3.ndb");
                odb = Open("array3.ndb");
                var array = new short[size];
                for (var i = 0; i < size; i++)
                {
                    array[i] = (short)i;
                }
                var owna = new ObjectWithNativeArrayOfShort("t1", array);
                odb.Store(owna);
                odb.Close();
                odb = Open("array3.ndb");
                var query = odb.Query <ObjectWithNativeArrayOfShort>();
                var l     = query.Execute <ObjectWithNativeArrayOfShort>();
                var owna2 = l.GetFirst();
                AssertEquals(owna.GetName(), (string)owna2.GetName());
                for (var i = 0; i < size; i++)
                {
                    AssertEquals(owna.GetNumbers()[i], (short)owna2.GetNumbers()[i]);
                }
                odb.Close();
                odb = null;
            }
            catch (Exception)
            {
                if (odb != null)
                {
                    odb.Rollback();
                    odb = null;
                }
                throw;
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
                DeleteBase("array3.ndb");
            }
        }
Beispiel #2
0
 public virtual void TestArray3()
 {
     IOdb odb = null;
     var size = 50;
     try
     {
         DeleteBase("array3.ndb");
         odb = Open("array3.ndb");
         var array = new short[size];
         for (var i = 0; i < size; i++)
             array[i] = (short) i;
         var owna = new ObjectWithNativeArrayOfShort("t1", array);
         odb.Store(owna);
         odb.Close();
         odb = Open("array3.ndb");
         var query = odb.Query<ObjectWithNativeArrayOfShort>();
         var l = query.Execute<ObjectWithNativeArrayOfShort>();
         var owna2 = l.GetFirst();
         AssertEquals(owna.GetName(), (string) owna2.GetName());
         for (var i = 0; i < size; i++)
             AssertEquals(owna.GetNumbers()[i], (short) owna2.GetNumbers()[i]);
         odb.Close();
         odb = null;
     }
     catch (Exception)
     {
         if (odb != null)
         {
             odb.Rollback();
             odb = null;
         }
         throw;
     }
     finally
     {
         if (odb != null)
             odb.Close();
         DeleteBase("array3.ndb");
     }
 }