2 // Tests for System.Web.UI.WebControls.ValidatedControlConverterTest.cs
5 // Peter Dennis Bartok (pbartok@novell.com)
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using NUnit.Framework;
33 using System.Collections;
34 using System.ComponentModel;
36 using System.Globalization;
38 using ComponentSpace = System.ComponentModel;
40 using System.Web.UI.WebControls;
42 namespace MonoTests.System.Web.UI.WebControls
45 public class ValidatedControlConverterTest {
46 public class ControlContainer : IContainer {
47 ComponentCollection col;
49 public ControlContainer(ICollection collection) {
50 Control[] controls = new Control[collection.Count];
54 foreach(Control c in collection) {
58 col = new ComponentCollection(controls);
61 public ComponentCollection Components {
65 public void Remove(IComponent component) { }
66 public void Add(IComponent component, string name) { }
67 void ComponentSpace.IContainer.Add(IComponent component) { }
68 public void Dispose() { }
71 public class ControlTypeDescriptorContext : ITypeDescriptorContext {
74 public ControlTypeDescriptorContext (ICollection collection) {
75 cc = new ControlContainer(collection);
79 public IContainer Container {
85 public void OnComponentChanged() { }
86 public bool OnComponentChanging() { return false; }
87 public object Instance { get { return null; } }
88 public PropertyDescriptor PropertyDescriptor { get { return null; } }
89 public object GetService(Type serviceType) { return null; }
92 public class NamingContainer : WebControl, INamingContainer {
97 [NUnit.Framework.Category("NotWorking")]
98 public void Basic () {
101 ValidatedControlConverter conv;
102 TypeConverter.StandardValuesCollection values;
103 NamingContainer container;
107 ControlTypeDescriptorContext context;
109 container = new NamingContainer ();
110 ctl1 = new TextBox ();
111 ctl2 = new TextBox ();
112 ddl = new DropDownList();
114 // Button has no ValidationProperty and will not show in the list
117 container.Controls.Add (ctl1);
118 container.Controls.Add (ctl2);
119 container.Controls.Add (btn);
120 container.Controls.Add (ddl);
122 container.ID = "naming";
128 context = new ControlTypeDescriptorContext(container.Controls);
129 conv = new ValidatedControlConverter();
131 values = conv.GetStandardValues(context);
132 Assert.IsNull (values, "B1");