public void OnReadOnlyCollection_CollectionIsSerialized()
 {
     CollParent parent = new CollParent();
     parent.Items.Add(new CollItem("2"));
     parent.Items.Add(new CollItem("Two"));
     Serializer s = new Serializer(typeof(CollParent));
     string result = s.Serialize(parent);
     CollParent actual = (CollParent)s.Deserialize(result);
     Assert.AreEqual(2, actual.Items.Count, "Wrong item count on readonly collection");
     Assert.AreEqual("2", actual.Items[0].Value, "Wrong item in first position");
     Assert.AreEqual("Two", actual.Items[1].Value, "Wrong item in first position");
 }
Exemplo n.º 2
0
        public void OnReadOnlyCollection_CollectionIsSerialized()
        {
            CollParent parent = new CollParent();

            parent.Items.Add(new CollItem("2"));
            parent.Items.Add(new CollItem("Two"));
            Serializer s      = new Serializer();
            string     result = s.Serialize(parent);
            CollParent actual = s.Deserialize <CollParent>(result);

            Assert.AreEqual(2, actual.Items.Count, "Wrong item count on readonly collection");
            Assert.AreEqual("2", actual.Items[0].Value, "Wrong item in first position");
            Assert.AreEqual("Two", actual.Items[1].Value, "Wrong item in first position");
        }