Пример #1
0
        public virtual void TestArray1()
		{
			NeoDatis.Odb.ODB odb = null;
			try
			{
				DeleteBase("array1.neodatis");
				odb = Open("array1.neodatis");
				decimal nb = odb.Count(new CriteriaQuery(typeof(
					PlayerWithArray)));
				PlayerWithArray player = new PlayerWithArray
					("kiko");
				player.AddGame("volley-ball");
				player.AddGame("squash");
				player.AddGame("tennis");
				player.AddGame("ping-pong");
				odb.Store(player);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<PlayerWithArray> l = odb.GetObjects<PlayerWithArray>(true);
				AssertEquals(nb + 1, l.Count);
				// gets first player
				PlayerWithArray player2 = l.GetFirst();
				AssertEquals(player.ToString(), player2.ToString());
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
                Console.WriteLine(e);
				throw e;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}
Пример #2
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestArrayQuery()
		{
			NeoDatis.Odb.ODB odb = null;
			try
			{
				DeleteBase("array1.neodatis");
				odb = Open("array1.neodatis");
				decimal nb = odb.Count(new CriteriaQuery(typeof(
					PlayerWithArray)));
				PlayerWithArray player = new PlayerWithArray
					("kiko");
				player.AddGame("volley-ball");
				player.AddGame("squash");
				player.AddGame("tennis");
				player.AddGame("ping-pong");
				odb.Store(player);
				odb.Close();
				odb = Open("array1.neodatis");
                NeoDatis.Odb.Objects<PlayerWithArray> l = odb.GetObjects < PlayerWithArray>(new CriteriaQuery(Where.Contain("games", "tennis")));
				AssertEquals(nb + 1, l.Count);
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
				throw;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}