public void DeepClone_ListNull_AsReference(TypeModel model) { var list = new ListOfPrimitive() { Collection = null }; var clone = (ListOfPrimitive)model.DeepClone(list); Assert.IsNull(clone.Collection); }
public void DeepClone_ListEmpty_NotAsReference(TypeModel model) { var manualModel = TypeModel.Create(); manualModel.Add(typeof(ListOfPrimitive), true).AddField(1, "Collection"); var list = new ListOfPrimitive() { Collection = new List<int>() }; var clone = (ListOfPrimitive)manualModel.DeepClone(list); Assert.IsNotNull(clone.Collection); Assert.IsEmpty(clone.Collection); }
public void DeepClone_ListOfPrimitive_AsReference(TypeModel model) { var list = new ListOfPrimitive() { Collection = new List<int> { 12, 43 } }; var clone = (ListOfPrimitive)model.DeepClone(list); Assert.AreEqual(list.Collection.Count, clone.Collection.Count); for (var i = 0; i < list.Collection.Count; i++) { Assert.AreEqual(list.Collection[i], clone.Collection[i]); } }