Example #1
0
        public void IsDelegateTest()
        {
            using DataTarget dt      = TestTargets.Types.LoadFullDump();
            using ClrRuntime runtime = dt.ClrVersions.Single().CreateRuntime();
            ClrModule typesModule = runtime.GetModule(TypeTests.ModuleName);
            ClrType   type        = typesModule.GetTypeByName("Types");

            ClrObject TestDelegate = type.GetStaticFieldByName("TestDelegate").ReadObject(runtime.AppDomains.Single());

            Assert.True(TestDelegate.IsValid);
            Assert.True(TestDelegate.IsDelegate);
            Assert.False(TestDelegate.AsDelegate().HasMultipleTargets);

            ClrObject TestEvent = type.GetStaticFieldByName("TestEvent").ReadObject(runtime.AppDomains.Single());

            Assert.True(TestEvent.IsValid);
            Assert.True(TestEvent.IsDelegate);
            Assert.True(TestEvent.AsDelegate().HasMultipleTargets);
        }