コード例 #1
0
        public virtual void Test()
        {
            StoreItems(new string[] { "1", "2", "3" });
            Db().Commit();
            long initialTransactionVersionNumber = Db().Version();

            UpdateItem("2", "modified2");
            Db().Commit();
            long   updatedTransactionVersionNumber = Db().Version();
            IQuery q = Db().Query();

            q.Constrain(typeof(QueryingVersionFieldTestCase.Item));
            q.Descend(VirtualField.CommitTimestamp).Constrain(initialTransactionVersionNumber
                                                              ).Greater();
            // This part really isn't needed for this test case, but it shows, how changes
            // between two specific transaction commits can be queried.
            q.Descend(VirtualField.CommitTimestamp).Constrain(updatedTransactionVersionNumber
                                                              ).Smaller().Equal();
            IObjectSet objectSet = q.Execute();

            Assert.AreEqual(1, objectSet.Count);
            QueryingVersionFieldTestCase.Item item = (QueryingVersionFieldTestCase.Item)objectSet
                                                     .Next();
            Assert.AreEqual("modified2", item.name);
        }
コード例 #2
0
 private void StoreItems(string[] names)
 {
     for (int i = 0; i < names.Length; i++)
     {
         QueryingVersionFieldTestCase.Item item = new QueryingVersionFieldTestCase.Item(names
                                                                                        [i]);
         Store(item);
     }
 }
コード例 #3
0
		private void StoreItems(string[] names)
		{
			for (int i = 0; i < names.Length; i++)
			{
				QueryingVersionFieldTestCase.Item item = new QueryingVersionFieldTestCase.Item(names
					[i]);
				Store(item);
			}
		}
コード例 #4
0
 private void UpdateItem(string originalName, string updatedName)
 {
     QueryingVersionFieldTestCase.Item item = QueryForItem(originalName);
     item.name = updatedName;
     Store(item);
 }