| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // System.ComponentModel.Container test cases
- //
- // Authors:
- // Gonzalo Paniagua Javier ([email protected])
- //
- // 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 ());
- }
- }
- }
|