Пример #1
0
        public virtual void TestArrayOfDate()
        {
            NeoDatis.Odb.ODB odb = null;
            int size             = 50;

            try
            {
                DeleteBase("array1.neodatis");
                odb = Open("array1.neodatis");
                System.DateTime[] array = new System.DateTime[size];
                System.DateTime   now   = new System.DateTime();
                for (int i = 0; i < size; i++)
                {
                    array[i] = new System.DateTime(now.Millisecond + i);
                }
                ObjectWithNativeArrayOfDate owna = new ObjectWithNativeArrayOfDate
                                                       ("t1", array);
                odb.Store(owna);
                odb.Close();
                odb = Open("array1.neodatis");
                NeoDatis.Odb.Objects <ObjectWithNativeArrayOfDate> l = odb.GetObjects <ObjectWithNativeArrayOfDate>();
                ObjectWithNativeArrayOfDate owna2 = l.GetFirst();
                AssertEquals(owna.GetName(), owna2.GetName());
                for (int i = 0; i < size; i++)
                {
                    AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]);
                }
                odb.Close();
                odb = null;
            }
            catch (System.Exception e)
            {
                if (odb != null)
                {
                    odb.Rollback();
                    odb = null;
                }
                throw;
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
                DeleteBase("array1.neodatis");
            }
        }
Пример #2
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestArrayOfDate()
		{
			NeoDatis.Odb.ODB odb = null;
			int size = 50;
			try
			{
				DeleteBase("array1.neodatis");
				odb = Open("array1.neodatis");
				System.DateTime[] array = new System.DateTime[size];
				System.DateTime now = new System.DateTime();
				for (int i = 0; i < size; i++)
				{
					array[i] = new System.DateTime(now.Millisecond + i);
				}
				ObjectWithNativeArrayOfDate owna = new ObjectWithNativeArrayOfDate
					("t1", array);
				odb.Store(owna);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<ObjectWithNativeArrayOfDate> l = odb.GetObjects<ObjectWithNativeArrayOfDate>();
				ObjectWithNativeArrayOfDate owna2 = l.GetFirst();
				AssertEquals(owna.GetName(), owna2.GetName());
				for (int i = 0; i < size; i++)
				{
					AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]);
				}
				odb.Close();
				odb = null;
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
				throw;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}