Esempio n. 1
0
        public void ShouldCreateCollectionSerialiserWhenCollectionPropertyIsPassed()
        {
            DefaultSerialiserFactory   factory    = new DefaultSerialiserFactory();
            PropertyInfo               property   = typeof(Project).GetProperty("Triggers");
            ReflectorPropertyAttribute attribute  = (ReflectorPropertyAttribute)property.GetCustomAttributes(false)[0];
            IXmlSerialiser             serialiser = factory.Create(ReflectorMember.Create(property), attribute);

            Assert.AreEqual(typeof(XmlCollectionSerialiser), serialiser.GetType());
        }
Esempio n. 2
0
        public void ShouldCreateCollectionSerialiserWhenInstanceTypeIsCollection()
        {
            FieldInfo field = typeof(CollectionTestClass).GetField("Stuff");

            attribute = (ReflectorPropertyAttribute)field.GetCustomAttributes(false)[0];
            IXmlSerialiser serialiser = factory.Create(ReflectorMember.Create(field), attribute);

            Assert.AreEqual(typeof(XmlCollectionSerialiser), serialiser.GetType());
        }
Esempio n. 3
0
        public void ShouldCreateCollectionSerialiserWhenCollectionPropertyIsPassed()
        {
            IXmlSerialiser serialiser = factory.Create(ReflectorMember.Create(typeof(CollectionTestClass).GetProperty("List")), attribute);

            Assert.AreEqual(typeof(XmlCollectionSerialiser), serialiser.GetType());
        }
Esempio n. 4
0
        public void ShouldCreateArraySerialiserWhenArrayPropertyIsPassed()
        {
            IXmlSerialiser serialiser = factory.Create(ReflectorMember.Create(typeof(ArrayTestClass).GetProperty("Elements")), attribute);

            Assert.AreEqual(typeof(XmlArraySerialiser), serialiser.GetType());
        }