public static object GetSerializationObject(TestType testType, int testSize) { Object obj = null; switch (testType) { case TestType.ByteArray: obj = CreateByteArray(testSize); break; case TestType.Dictionary: obj = CreateDictionaryOfIntString(testSize); break; case TestType.ISerializable: obj = new ClassImplementingIXmlSerialiable() { StringValue = "Hello world" }; break; case TestType.ListOfInt: obj = CreateListOfInt(testSize); break; case TestType.SimpleType: obj = CreateSimpleTypeWihtMoreProperties(testSize, 0, -1, 7, 2); break; case TestType.SimpleTypeWithFields: obj = CreateSimpleTypeWithFields(testSize, 0, -1, 7, 2); break; case TestType.String: obj = new string('k', testSize); break; case TestType.XmlElement: XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(@"<html></html>"); XmlElement xmlElement = xmlDoc.CreateElement("Element"); xmlElement.InnerText = "Element innertext"; obj = xmlElement; break; case TestType.DateTimeArray: obj = CreateDateTimeArray(testSize); break; case TestType.ArrayOfSimpleType: obj = CreateArrayOfSimpleType(testSize); break; case TestType.ListOfSimpleType: obj = CreateListOfSimpleType(testSize); break; case TestType.DictionaryOfSimpleType: obj = CreateDictionaryOfIntSimpleType(testSize); break; case TestType.SimpleStructWithProperties: obj = new SimpleStructWithProperties() { Num = 1, Text = "Foo" }; break; default: throw new ArgumentException(); } return obj; }
public static object GetSerializationObject(TestType testType, int testSize) { object obj = null; switch (testType) { case TestType.ByteArray: obj = CreateByteArray(testSize); break; case TestType.Dictionary: obj = CreateDictionaryOfIntString(testSize); break; case TestType.ISerializable: obj = new ClassImplementingIXmlSerialiable() { StringValue = "Hello world" }; break; case TestType.ListOfInt: obj = CreateListOfInt(testSize); break; case TestType.SimpleType: obj = CreateSimpleTypeWihtMoreProperties(testSize, 0, -1, 7, 2); break; case TestType.SimpleTypeWithFields: obj = CreateSimpleTypeWithFields(testSize, 0, -1, 7, 2); break; case TestType.String: obj = new string('k', testSize); break; case TestType.XmlElement: XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(@"<html></html>"); XmlElement xmlElement = xmlDoc.CreateElement("Element"); xmlElement.InnerText = "Element innertext"; obj = xmlElement; break; case TestType.DateTimeArray: obj = CreateDateTimeArray(testSize); break; case TestType.ArrayOfSimpleType: obj = CreateArrayOfSimpleType(testSize); break; case TestType.ListOfSimpleType: obj = CreateListOfSimpleType(testSize); break; case TestType.DictionaryOfSimpleType: obj = CreateDictionaryOfIntSimpleType(testSize); break; case TestType.SimpleStructWithProperties: obj = new SimpleStructWithProperties() { Num = 1, Text = "Foo" }; break; default: throw new ArgumentException(); } return(obj); }