XmlSerializerTestClasses.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // System.Xml.XmlSerializerTestClasses
  3. //
  4. // Author:
  5. // Erik LeBel <[email protected]>
  6. //
  7. // (C) 2003 Erik LeBel
  8. //
  9. // Classes to use in the testing of the XmlSerializer
  10. //
  11. using System;
  12. using System.Collections;
  13. using System.Xml.Serialization;
  14. namespace MonoTests.System.Xml.TestClasses
  15. {
  16. public enum SimpleEnumeration { FIRST, SECOND };
  17. public class SimpleClass
  18. {
  19. public string something = null;
  20. }
  21. public class StringCollection : CollectionBase
  22. {
  23. public void Add (String parameter)
  24. {
  25. List.Insert (Count, parameter);
  26. }
  27. public String this [int index]
  28. {
  29. get
  30. {
  31. if (index < 0 || index > Count)
  32. throw new ArgumentOutOfRangeException ();
  33. return (String) List [index];
  34. }
  35. set { List [index] = value; }
  36. }
  37. }
  38. public class StringCollectionContainer
  39. {
  40. StringCollection messages = new StringCollection();
  41. public StringCollection Messages
  42. {
  43. get { return messages; }
  44. }
  45. }
  46. public class ArrayContainer
  47. {
  48. public object [] items = null;
  49. }
  50. public class ClassArrayContainer
  51. {
  52. public SimpleClass [] items = null;
  53. }
  54. [XmlRoot("simple")]
  55. public class SimpleClassWithXmlAttributes
  56. {
  57. [XmlAttribute("member")]
  58. public string something = null;
  59. }
  60. [XmlRoot("field")]
  61. public class Field
  62. {
  63. [XmlAttribute("modifiers")]
  64. public MapModifiers Modifiers;
  65. }
  66. [Flags]
  67. public enum MapModifiers
  68. {
  69. [XmlEnum("public")]
  70. Public = 0,
  71. [XmlEnum("protected")]
  72. Protected = 1,
  73. }
  74. }