* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / corlib / Test / System / DelegateTest.cs
1 // DelegateTest.cs - NUnit Test Cases for the System.Delegate class
2 //
3 // (C) Ximian, Inc.  http://www.ximian.com
4 //
5
6 using NUnit.Framework;
7 using System;
8 using System.Reflection;
9
10 namespace MonoTests.System
11 {
12
13 [TestFixture]
14 public class DelegateTest : Assertion
15 {
16 #if NET_2_0
17         class ParentClass {
18         }
19
20         class Subclass : ParentClass {
21         }
22
23         delegate ParentClass CoContraVariantDelegate (Subclass s);
24
25         static Subclass CoContraVariantMethod (ParentClass s) {
26                 return null;
27         }
28
29         [Test]
30         public void CoContraVariance () {
31                 CoContraVariantDelegate d = (CoContraVariantDelegate)Delegate.CreateDelegate (typeof (CoContraVariantDelegate), typeof (DelegateTest).GetMethod ("CoContraVariantMethod", BindingFlags.NonPublic|BindingFlags.Static));
32
33                 d (null);
34         }
35 #endif
36 }
37 }