2 // System.Xml.XmlSerializerTestClasses
\r
5 // Erik LeBel <eriklebel@yahoo.ca>
\r
7 // (C) 2003 Erik LeBel
\r
9 // Classes to use in the testing of the XmlSerializer
\r
13 using System.ComponentModel;
\r
14 using System.Collections;
\r
15 using System.Xml.Serialization;
\r
18 namespace MonoTests.System.Xml.TestClasses
\r
20 public enum SimpleEnumeration { FIRST, SECOND };
\r
22 public class SimpleClass
\r
24 public string something = null;
\r
27 public class StringCollection : CollectionBase
\r
29 public void Add (String parameter)
\r
31 List.Insert (Count, parameter);
\r
34 public String this [int index]
\r
38 if (index < 0 || index > Count)
\r
39 throw new ArgumentOutOfRangeException ();
\r
41 return (String) List [index];
\r
43 set { List [index] = value; }
\r
47 public class StringCollectionContainer
\r
49 StringCollection messages = new StringCollection();
\r
51 public StringCollection Messages
\r
53 get { return messages; }
\r
57 public class ArrayContainer
\r
59 public object [] items = null;
\r
62 public class ClassArrayContainer
\r
64 public SimpleClass [] items = null;
\r
68 public class SimpleClassWithXmlAttributes
\r
70 [XmlAttribute("member")]
\r
71 public string something = null;
\r
77 [XmlAttribute("modifiers")]
\r
78 public MapModifiers Modifiers;
\r
82 public enum MapModifiers
\r
86 [XmlEnum("protected")]
\r
90 public class MyList : ArrayList
\r
94 // NOTE: MyList has no public constructor
\r
95 public MyList (object container) : base()
\r
97 this.container = container;
\r
101 public class Container
\r
103 public MyList Items;
\r
105 public Container () {
\r
106 Items = new MyList(this);
\r
110 public class Container2
\r
112 public MyList Items;
\r
114 public Container2 () {
\r
117 public Container2 (bool b) {
\r
118 Items = new MyList(this);
\r
122 public class MyElem: XmlElement
124 public MyElem (XmlDocument doc): base ("","myelem","", doc)
126 SetAttribute ("aa","1");
133 public class MyDocument: XmlDocument
143 public class CDataContainer
145 public XmlCDataSection cdata;
148 public class NodeContainer
153 public class Choices
\r
155 [XmlElementAttribute("ChoiceZero", typeof(string), IsNullable=false)]
\r
156 [XmlElementAttribute("ChoiceOne", typeof(string), IsNullable=false)]
\r
157 [XmlElementAttribute("ChoiceTwo", typeof(string), IsNullable=false)]
\r
158 [XmlChoiceIdentifier("ItemType")]
\r
159 public string MyChoice;
\r
162 public ItemChoiceType ItemType;
\r
165 [XmlType(IncludeInSchema = false)]
\r
166 public enum ItemChoiceType
\r
169 [XmlEnum ("ChoiceOne")]
\r
174 public class WrongChoices
\r
176 [XmlElementAttribute("ChoiceZero", typeof(string), IsNullable=false)]
\r
177 [XmlElementAttribute("StrangeOne", typeof(string), IsNullable=false)]
\r
178 [XmlElementAttribute("ChoiceTwo", typeof(string), IsNullable=false)]
\r
179 [XmlChoiceIdentifier("ItemType")]
\r
180 public string MyChoice;
\r
183 public ItemChoiceType ItemType;
\r
186 [XmlType ("Type with space")]
187 public class TestSpace
189 [XmlElement (ElementName = "Element with space")]
192 [XmlAttribute (AttributeName = "Attribute with space")]
197 public class ReadOnlyProperties {
198 string[] strArr = new string[2] { "string1", "string2" };
200 public string[] StrArr {
201 get { return strArr; }
205 get { return "fff"; }
210 public class ListDefaults
212 public ListDefaults ()
214 ed = new SimpleClass ();
218 public ArrayList list2;
222 public string[] list4;
224 [XmlElement("e", typeof(SimpleClass))]
225 public ArrayList list5;
227 [DefaultValue (null)]
228 public SimpleClass ed;
230 [DefaultValue (null)]
234 public class clsPerson
236 public IList EmailAccounts;
239 public class ArrayClass
241 public object names = new object[] { "un","dos" };