5a29ec37dd27dbeace1239912b2141f8fb0979d3
[mono.git] / mcs / class / System.Web / Test / mainsoft / NunitWeb / NunitWeb / CustomSection.cs
1 using System;
2 using System.Configuration;
3
4 namespace MonoTests.SystemWeb.Framework
5 {
6     public class CustomSection : ConfigurationSection
7     {
8         [ConfigurationProperty ("sections", IsRequired = true)]
9         public CustomSubSectionCollection AreaSections {
10             get {
11                 return (CustomSubSectionCollection) base["sections"];
12             }
13             set {
14                 base["sections"] = value;
15             }
16         }
17     }
18
19     public class CustomSubSectionCollection : ConfigurationElementCollection
20     {
21         protected override ConfigurationElement CreateNewElement () {
22             return new CustomTagCollection ();
23         }
24
25         protected override object GetElementKey (ConfigurationElement element) {
26             return (element as CustomTagCollection).Area;
27         }
28     }
29
30     public class CustomTagCollection : ConfigurationElementCollection
31     {
32         protected override ConfigurationElement CreateNewElement () {
33             return new CustomTagElement ();
34         }
35
36         protected override object GetElementKey (ConfigurationElement element) {
37             return ((CustomTagElement) element).Name;
38         }
39
40         [ConfigurationProperty ("area", DefaultValue = "UndefinedArea", IsKey = true, IsRequired = true)]
41         public string Area {
42             get {
43                 return (string) base["area"];
44             }
45         }
46     }
47
48     public class CustomTagElement : ConfigurationElement
49     {
50         [ConfigurationProperty ("name", DefaultValue = "CustomName", IsKey = true, IsRequired = true)]
51         public string Name {
52             get {
53                 return (string) base["name"];
54             }
55         }
56     }
57 }