[InlineData(typeof(UninitializedPOCO), 4)] // Should not create data for null properties, or should it ?? public void PropertyContainerBuilder_CreateObject_MustCreatesObjectWithCorrectCount(Type t, int count) { var obj = Activator.CreateInstance(t); IPropertyContainer property = PropertyContainerBuilder.CreateObject("Untitled", obj); Assert.Equal(count, property.Count); }
public void PropertyContainerBuilder_CreateObject_MustCreateObjectWithCorrectValue(Type t) { var obj = Activator.CreateInstance(t); IPropertyContainer property = PropertyContainerBuilder.CreateObject("Untitled", obj); foreach (var item in property) { var expected = t.GetProperty(item.Name).GetValue(obj); var actual = item.GetValue(); Assert.Equal(expected, actual); } }
public void DataContainerBase_Morph_MustRecreateObjectWithIDataContainerProperty() { var obj = new Component(); IDataContainer dc = PropertyContainerBuilder.CreateObject("", obj); string xml = XmlHelper.SerializeToString(dc); IDataContainer dc2 = XmlHelper.DeserializeFromString <PropertyContainer>(xml); Component obj2 = dc2.Morph <Component>(); Assert.NotNull(obj2.TestParameters); Assert.Equal(obj.TestParameters.Count, obj2.TestParameters.Count); }