Пример #1
0
        public void WrittenDataShouldBeConstant()
        {
            var container = new ObjectArrayContainerClass();
            container.ObjectArray = this.CreateArray();
            var ms = new MemoryStream();
            var model = CreateModel();
            model.DynamicTypeFormatting += new TypeFormatEventHandler(model_DynamicTypeFormatting);
            model.Serialize(ms, container);

            string s = Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length);
            // written with r480
            Assert.AreEqual("ChkgAUIEQmFzZVIPCg1CYXNlQ2xhc3NUZXh0CjEgAkIHRGVyaXZlZFIkogYSChBEZXJpdmVkQ2xhc3NUZXh0Cg1CYXNlQ2xhc3NUZXh0", s);
        }
Пример #2
0
        public void WrittenDataShouldBeConstant()
        {
            var container = new ObjectArrayContainerClass();

            container.ObjectArray = this.CreateArray();
            var ms    = new MemoryStream();
            var model = CreateModel();

            model.DynamicTypeFormatting += new TypeFormatEventHandler(model_DynamicTypeFormatting);
            model.Serialize(ms, container);

            string s = Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length);

            // written with r480
            Assert.AreEqual("ChkgAUIEQmFzZVIPCg1CYXNlQ2xhc3NUZXh0CjEgAkIHRGVyaXZlZFIkogYSChBEZXJpdmVkQ2xhc3NUZXh0Cg1CYXNlQ2xhc3NUZXh0", s);
        }
        [Test] // needs dynamic handling of list itself
        public void TestObjectArrayContainerClass()
        {
            var model = CreateModel();
            var container = new ObjectArrayContainerClass();
            container.ObjectArray = this.CreateArray();
            var cloned = (ObjectArrayContainerClass)model.DeepClone(container);
            Expect(cloned.ObjectArray, Is.Not.Null);

            foreach (var obj in cloned.ObjectArray)
            {
                Expect(obj as Base, Is.Not.Null);
            }

            Expect(cloned.ObjectArray[1] as Derived, Is.Not.Null);
            Expect(cloned.ObjectArray.GetType(), Is.EqualTo(typeof(Base[])));

        }
Пример #4
0
        [Test] // needs dynamic handling of list itself
        public void TestObjectArrayContainerClass()
        {
            var model     = CreateModel();
            var container = new ObjectArrayContainerClass();

            container.ObjectArray = this.CreateArray();
            var cloned = (ObjectArrayContainerClass)model.DeepClone(container);

            Expect(cloned.ObjectArray, Is.Not.Null);

            foreach (var obj in cloned.ObjectArray)
            {
                Expect(obj as Base, Is.Not.Null);
            }

            Expect(cloned.ObjectArray[1] as Derived, Is.Not.Null);
            Expect(cloned.ObjectArray.GetType(), Is.EqualTo(typeof(Base[])));
        }
Пример #5
0
        [Test] // needs dynamic handling of list itself
        public void TestObjectArrayContainerClass()
        {
            var model = CreateModel();
            var container = new ObjectArrayContainerClass();
            container.ObjectArray = this.CreateArray();
            var cloned = (ObjectArrayContainerClass)model.DeepClone(container);
            Expect(cloned.ObjectArray, Is.Not.Null);

            foreach (var obj in cloned.ObjectArray)
            {
                Expect(obj as Base, Is.Not.Null);
            }

            Expect(cloned.ObjectArray[1] as Derived, Is.Not.Null);
            
            // this would be nice...
            //Expect(cloned.ObjectArray.GetType(), Is.EqualTo(typeof(Base[])));

            // but this is what we currently **expect**
            Expect(cloned.ObjectArray.GetType(), Is.EqualTo(typeof(object[])));
        }
Пример #6
0
        [Test] // needs dynamic handling of list itself
        public void TestObjectArrayContainerClass()
        {
            var model     = CreateModel();
            var container = new ObjectArrayContainerClass();

            container.ObjectArray = this.CreateArray();
            var cloned = (ObjectArrayContainerClass)model.DeepClone(container);

            Assert.IsNotNull(cloned.ObjectArray);

            foreach (var obj in cloned.ObjectArray)
            {
                Assert.IsNotNull(obj as Base);
            }

            Assert.IsNotNull(cloned.ObjectArray[1] as Derived);

            // this would be nice...
            //Expect(cloned.ObjectArray.GetType(), Is.EqualTo(typeof(Base[])));

            // but this is what we currently **expect**
            Assert.AreEqual(typeof(object[]), cloned.ObjectArray.GetType());
        }