mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
* ContainerTest.cs: new test. svn path=/trunk/mcs/; revision=56342
58 lines
1.1 KiB
C#
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 ());
|
|
}
|
|
}
|
|
}
|
|
|