2
0

XmlSerializerTestClasses.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. public class MyList : ArrayList
  75. {
  76. object container;
  77. // NOTE: MyList has no public constructor
  78. public MyList (object container) : base()
  79. {
  80. this.container = container;
  81. }
  82. }
  83. public class Container
  84. {
  85. public MyList Items;
  86. public Container () {
  87. Items = new MyList(this);
  88. }
  89. }
  90. public class Container2
  91. {
  92. public MyList Items;
  93. public Container2 () {
  94. }
  95. public Container2 (bool b) {
  96. Items = new MyList(this);
  97. }
  98. }
  99. }