Beispiel #1
0
        public void TestSerializeSchemaPropertyValueCollection()
        {
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            System.IO.MemoryStream        ms   = new System.IO.MemoryStream();
            SchemaPropertyValueCollection obj1 = new SchemaPropertyValueCollection();

            SCGroup group = SCObjectGenerator.PrepareGroupObject();

            foreach (string key in group.Properties.GetAllKeys())
            {
                obj1.Add(group.Properties[key]);
            }

            bf.Serialize(ms, obj1);
            ms.Seek(0, System.IO.SeekOrigin.Begin);

            var obj2 = (SchemaPropertyValueCollection)bf.Deserialize(ms);

            Assert.AreEqual(obj1.Count, obj2.Count);

            var keys1 = obj1.GetAllKeys();

            foreach (var key in keys1)
            {
                Assert.IsTrue(obj2.ContainsKey(key));
                Assert.AreEqual(obj1[key].StringValue, obj2[key].StringValue);
            }
        }
Beispiel #2
0
        public void TestSerializeGroup()
        {
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            SCGroup obj1 = SCObjectGenerator.PrepareGroupObject();

            obj1.CreateDate     = DateTime.Now;
            obj1.VersionEndTime = new DateTime(567890);
            obj1.VersionEndTime = DateTime.MaxValue;
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            bf.Serialize(ms, obj1);
            ms.Seek(0, System.IO.SeekOrigin.Begin);
            SCGroup obj2 = (SCGroup)bf.Deserialize(ms);

            CommonAssert(obj1, obj2);
        }