コード例 #1
0
        public virtual void TestTimeStamp()
        {
            IQuery q = NewItemQuery();

            q.Descend("name").Constrain("one");
            UUIDTestCase.Item item = (UUIDTestCase.Item)q.Execute().Next();
            Db4oUUID          uuid = Uuid(item);
            long longPart          = uuid.GetLongPart();
            long creationTime      = TimeStampIdGenerator.IdToMilliseconds(longPart);

            Assert.IsGreaterOrEqual(storeStartTime, creationTime);
            Assert.IsSmallerOrEqual(storeEndTime, creationTime);
        }
コード例 #2
0
        protected virtual void AssertItemsCanBeRetrievedByUUID(Hashtable4 uuidCache)
        {
            IQuery     q         = NewItemQuery();
            IObjectSet objectSet = q.Execute();

            while (objectSet.HasNext())
            {
                UUIDTestCase.Item item = (UUIDTestCase.Item)objectSet.Next();
                Db4oUUID          uuid = Uuid(item);
                Assert.IsNotNull(uuid);
                Assert.AreSame(item, Db().GetByUUID(uuid));
                Db4oUUID cached = (Db4oUUID)uuidCache.Get(item.name);
                if (cached != null)
                {
                    Assert.AreEqual(cached, uuid);
                }
                else
                {
                    uuidCache.Put(item.name, uuid);
                }
            }
        }