예제 #1
0
        public void SerializeIXmlSerializable()
        {
            var value = new ClassImplementingIXmlSerialiable()
            {
                StringValue = "Hello world"
            };

            RunXmlSerializationTest(value, 10000);
        }
예제 #2
0
        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.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;

            default:
                throw new ArgumentException();
            }
            return(obj);
        }
예제 #3
0
 public void DeserializeIXmlSerializable()
 {
     var value = new ClassImplementingIXmlSerialiable() { StringValue = "Hello world" };
     RunXmlDeserializationTest(value, 10000);
 }
예제 #4
0
 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.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;
         default:
             throw new ArgumentException();
     }
     return obj;
 }