Files
mono/mcs/class/System/Test/System.ComponentModel/ContainerTest.cs
T
Gonzalo Paniagua Javier d5d12aa737 2006-01-31 Gonzalo Paniagua Javier <[email protected]>
* ContainerTest.cs: new test.


svn path=/trunk/mcs/; revision=56342
2006-01-31 17:06:36 +00:00

58 lines
1.1 KiB
C#

//
// 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 ());
}
}
}