2006-01-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 31 Jan 2006 17:06:36 +0000 (17:06 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 31 Jan 2006 17:06:36 +0000 (17:06 -0000)
* ContainerTest.cs: new test.

svn path=/trunk/mcs/; revision=56342

mcs/class/System/Test/System.ComponentModel/ChangeLog
mcs/class/System/Test/System.ComponentModel/ContainerTest.cs [new file with mode: 0644]

index 460d2607ec063e3bd477e408875e3a6bc76eb62f..04feb2a9824d2ffd90346d10de8a0183ec54c66f 100644 (file)
@@ -1,3 +1,7 @@
+2006-01-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ContainerTest.cs: new test.
+
 2005-09-29  Raja R Harinath  <harinath@gmail.com>
 
        * DateTimeConverterTests.cs (ConvertTo_MaxValue): Disable tests
diff --git a/mcs/class/System/Test/System.ComponentModel/ContainerTest.cs b/mcs/class/System/Test/System.ComponentModel/ContainerTest.cs
new file mode 100644 (file)
index 0000000..b34ac56
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// System.ComponentModel.Container test cases
+//
+// Authors:
+//     Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace MonoTests.System.ComponentModel
+{
+       class TestService {
+       }
+       
+       class TestContainer : Container {
+               ServiceContainer _services = new ServiceContainer();
+               
+               public TestContainer() {
+                       _services.AddService( typeof(TestService), new TestService() );
+               }
+               
+               protected override object GetService( Type serviceType ) {
+                       return _services.GetService( serviceType );
+               }
+       }
+       
+       class TestComponent : Component {
+               public override ISite Site {
+                       get {
+                               return base.Site;
+                       }
+                       set {
+                               base.Site = value;
+                               if (value != null) {
+                                       Assert.IsNotNull (value.GetService (typeof (ISite)));
+                                       Assert.IsNotNull (value.GetService (typeof (TestService)));
+                               }
+                       }
+               }
+       }
+
+       [TestFixture]
+       public class ContainerTest {
+               [Test]
+               public void GetService1 ()
+               {
+                       TestContainer container = new TestContainer ();
+                       container.Add (new TestComponent ());
+               }
+       }
+}
+