Exemplo n.º 1
0
 public void Setup()
 {
     tsc = new TimeStampContainer("Hans");
     pm1 = PmFactory.NewPersistenceManager();
     pm2 = PmFactory.NewPersistenceManager();
     pm1.MakePersistent(tsc);
     pm1.Save();
     pm1.UnloadCache();
 }
Exemplo n.º 2
0
        public void TestDeleteHollow()
        {
            IQuery q = new NDOQuery <TimeStampContainer>(pm1, null, true);

            tsc = (TimeStampContainer)q.ExecuteSingle(true);
            Assert.AreEqual(NDOObjectState.Hollow, tsc.NDOObjectState, "Object should be hollow");
            Assert.That(((IPersistenceCapable)tsc).NDOTimeStamp != Guid.Empty, "Time Stamp should be there");
            pm1.Delete(tsc);
            pm1.Save();
            pm1.UnloadCache();
            IList l = pm1.GetClassExtent(typeof(TimeStampContainer));

            Assert.AreEqual(0, l.Count, "No object should be there");
        }
Exemplo n.º 3
0
        public void TestTimeStampsNoException()
        {
            IList l1 = pm1.GetClassExtent(typeof(TimeStampContainer));

            Assert.AreEqual(1, l1.Count, "Count sollte 1 sein");
            IList l2 = pm2.GetClassExtent(typeof(TimeStampContainer));

            Assert.AreEqual(1, l2.Count, "Count sollte 1 sein");
            TimeStampContainer tsc1 = (TimeStampContainer)l1[0];
            TimeStampContainer tsc2 = (TimeStampContainer)l2[0];

            pm1.CollisionEvent += new CollisionHandler(OnCollisionEvent);
            tsc1.Name           = "Friedrich";
            tsc2.Name           = "Peter";
            pm2.Save();
            pm1.Save();
            Assert.AreEqual(true, collisionHappened, "Kollision ist nicht erkannt worden");
        }