Beispiel #1
0
        public virtual void TestInsertObjectWithOneToManyAssociations()
        {
            ObjectData data = CreateData(typeof(Team), 99, new FileVersion("user", 13));

            data.InitCollection("Members");
            SerialOid[] oid = new SerialOid[3];
            for (int i = 0; i < oid.Length; i++)
            {
                oid[i] = SerialOid.CreatePersistent(104 + i, typeof(Team).FullName);
                data.AddElement("Members", oid[i]);
            }
            manager.InsertObject(data);

            ObjectData read = manager.LoadObjectData(data.Oid);

            Assert.AreEqual(data.Oid, read.Oid);
            Assert.AreEqual(data.ClassName, read.ClassName);

            IList <IOid> c = read.Elements("Members");

            for (int i = 0; i < oid.Length; i++)
            {
                Assert.AreEqual(oid[i], c[i]);
            }
        }
Beispiel #2
0
        public virtual void TestInsertObjectWithEmptyOneToManyAssociations()
        {
            ObjectData data = CreateData(typeof(Team), 99, new FileVersion("user", 13));

            data.InitCollection("Members");

            manager.InsertObject(data);

            ObjectData read = manager.LoadObjectData(data.Oid);

            Assert.AreEqual(data.Oid, read.Oid);
            Assert.AreEqual(data.ClassName, read.ClassName);

            IList <IOid> c = read.Elements("Members");

            Assert.IsNull(c);
        }