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()); }
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()); }
public void ShouldCreateCollectionSerialiserWhenCollectionPropertyIsPassed() { IXmlSerialiser serialiser = factory.Create(ReflectorMember.Create(typeof(CollectionTestClass).GetProperty("List")), attribute); Assert.AreEqual(typeof(XmlCollectionSerialiser), serialiser.GetType()); }
public void ShouldCreateArraySerialiserWhenArrayPropertyIsPassed() { IXmlSerialiser serialiser = factory.Create(ReflectorMember.Create(typeof(ArrayTestClass).GetProperty("Elements")), attribute); Assert.AreEqual(typeof(XmlArraySerialiser), serialiser.GetType()); }