예제 #1
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestEventRegistryCounts()
		{
			RegisterEventHandlers();
			for (int i = 0; i < 1000; i++)
			{
				EventCountTestCase.Item item = new EventCountTestCase.Item(i);
				Db().Store(item);
				Assert.IsTrue(Db().IsStored(item));
				if (((i + 1) % 100) == 0)
				{
					Db().Commit();
				}
			}
			AssertCount(_created, 1000, "created");
			AssertCount(_committed, 10, "commit");
			ReopenAndRegister();
			IObjectSet items = NewQuery(typeof(EventCountTestCase.Item)).Execute();
			Assert.AreEqual(1000, items.Count, "Wrong number of objects retrieved");
			while (items.HasNext())
			{
				EventCountTestCase.Item item = (EventCountTestCase.Item)items.Next();
				item._value++;
				Store(item);
			}
			AssertCount(_activated, 1000, "activated");
			AssertCount(_updated, 1000, "updated");
			items.Reset();
			while (items.HasNext())
			{
				object item = items.Next();
				Db().Delete(item);
				Assert.IsFalse(Db().IsStored(item));
			}
			AssertCount(_deleted, 1000, "deleted");
		}
예제 #2
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestEventRegistryCounts()
        {
            RegisterEventHandlers();
            for (int i = 0; i < 1000; i++)
            {
                EventCountTestCase.Item item = new EventCountTestCase.Item(i);
                Db().Store(item);
                Assert.IsTrue(Db().IsStored(item));
                if (((i + 1) % 100) == 0)
                {
                    Db().Commit();
                }
            }
            AssertCount(_created, 1000, "created");
            AssertCount(_committed, 10, "commit");
            ReopenAndRegister();
            IObjectSet items = NewQuery(typeof(EventCountTestCase.Item)).Execute();

            Assert.AreEqual(1000, items.Count, "Wrong number of objects retrieved");
            while (items.HasNext())
            {
                EventCountTestCase.Item item = (EventCountTestCase.Item)items.Next();
                item._value++;
                Store(item);
            }
            AssertCount(_activated, 1000, "activated");
            AssertCount(_updated, 1000, "updated");
            items.Reset();
            while (items.HasNext())
            {
                object item = items.Next();
                Db().Delete(item);
                Assert.IsFalse(Db().IsStored(item));
            }
            AssertCount(_deleted, 1000, "deleted");
        }