public static SimpleTypeWithMoreFields CreateSimpleTypeWithFields(int height, int parentId, int currentId, int collectionSize, int childListSize) { int index = parentId * childListSize + (currentId + 1); var obj = new SimpleTypeWithMoreFields() { IntField = index, StringField = index + " string value", EnumField = (MyEnum)(index % (Enum.GetNames(typeof(MyEnum)).Length)), CollectionField = new List <string>(collectionSize), SimpleTypeList = new List <SimpleTypeWithMoreFields>(childListSize) }; for (int i = 0; i < collectionSize; ++i) { obj.CollectionField.Add(index + "." + i); } if (height > 1) { for (int i = 0; i < childListSize; ++i) { obj.SimpleTypeList.Add(CreateSimpleTypeWithFields(height - 1, index, i, collectionSize, childListSize)); } } return(obj); }
public static SimpleTypeWithMoreFields CreateSimpleTypeWithFields(int height, int parentId, int currentId, int collectionSize, int childListSize) { int index = parentId * childListSize + (currentId + 1); var obj = new SimpleTypeWithMoreFields() { IntField = index, StringField = index + " string value", EnumField = (MyEnum)(index % (Enum.GetNames(typeof(MyEnum)).Length)), CollectionField = new List<string>(collectionSize), SimpleTypeList = new List<SimpleTypeWithMoreFields>(childListSize) }; for (int i = 0; i < collectionSize; ++i) { obj.CollectionField.Add(index + "." + i); } if (height > 1) { for (int i = 0; i < childListSize; ++i) { obj.SimpleTypeList.Add(CreateSimpleTypeWithFields(height - 1, index, i, collectionSize, childListSize)); } } return obj; }