예제 #1
0
 public void RelationNullAssignment()
 {
     m.Hinzufuegen(r);
     pm.MakePersistent(m);
     pm.Save();
     pm.UnloadCache();
     m = (Mitarbeiter)pm.FindObject(m.NDOObjectId);
     //Assert.That(m.Reisen.Count == 1);
     m.ErsetzeReisen(null);
     pm.Save();
     pm.UnloadCache();
     m = (Mitarbeiter)pm.FindObject(m.NDOObjectId);
     Assert.That(m.Reisen.Count == 0, "Reisen should be empty");
 }
예제 #2
0
        public void TestAssignRelatedObjectsNullSave()
        {
            for (int i = 0; i < 3; i++)
            {
                m.Hinzufuegen(CreateReise(i.ToString()));
            }
            pm.MakePersistent(m);
            pm.Save();
            IList rr = new ArrayList(m.Reisen);

            m.ErsetzeReisen(null);
            Assert.Null(m.Reisen, "No objects should be there");
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(NDOObjectState.Deleted, ((Reise)rr[i]).NDOObjectState, "2. Wrong state");
            }
            pm.Save();
            Assert.Null(m.Reisen, "No objects should be there");
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(NDOObjectState.Transient, ((Reise)rr[i]).NDOObjectState, "4. Wrong state");
            }
        }
예제 #3
0
        public void RelationEmptyAssignment()
        {
            m.Hinzufuegen(r);
            pm.MakePersistent(m);
            pm.Save();
            pm.UnloadCache();
            m = (Mitarbeiter)pm.FindObject(m.NDOObjectId);
            //Assert.That(m.Reisen.Count == 1);
            m.ErsetzeReisen(new ArrayList());
            pm.Save();
            pm.UnloadCache();
//			// This code gets the same result
//			NDOQuery<Mitarbeiter> q = new NDOQuery<Mitarbeiter>(pm, "oid = {0}");
//			q.Parameters.Add(m.NDOObjectId.Id.Value);
//			m = (Mitarbeiter) q.ExecuteSingle(true);

            m = (Mitarbeiter)pm.FindObject(m.NDOObjectId);
            Assert.That(m.Reisen.Count == 0, "Reisen should be empty");
        }