+
+ [Test]
+ [EnvironmentPermission (SecurityAction.Deny, Read = "Mono")]
+ [ExpectedException (typeof (SecurityException))]
+ public void Ctor3_LinkDemand_Deny_Anything ()
+ {
+ // denying anything -> not unrestricted
+ Type[] types = new Type[3] { typeof (MemberInfo), typeof (ICollection), typeof (bool) };
+ ConstructorInfo ci = typeof (InstanceDescriptor).GetConstructor (types);
+ Assert.IsNotNull (ci, ".ctor(MemberInfo,ICollection,bool)");
+ Assert.IsNotNull (ci.Invoke (new object[3] { null, new object[] { }, false }), "invoke");
+ }
+
+ [Test]
+ [PermissionSet (SecurityAction.PermitOnly, Unrestricted = true)]
+ public void Ctor3_LinkDemand_PermitOnly_Unrestricted ()
+ {
+ Type[] types = new Type[3] { typeof (MemberInfo), typeof (ICollection), typeof (bool) };
+ ConstructorInfo ci = typeof (InstanceDescriptor).GetConstructor (types);
+ Assert.IsNotNull (ci, ".ctor(MemberInfo,ICollection,bool)");
+ Assert.IsNotNull (ci.Invoke (new object[3] { null, new object[] { }, false }), "invoke");
+ }
+
+ [Test]
+ [EnvironmentPermission (SecurityAction.Deny, Read = "Mono")]
+ [ExpectedException (typeof (SecurityException))]
+ public void Property_LinkDemand_Deny_Anything ()
+ {
+ InstanceDescriptor id = new InstanceDescriptor (null, new object[] { });
+ // denying anything -> not unrestricted
+ Type[] types = new Type[3] { typeof (MemberInfo), typeof (ICollection), typeof (bool) };
+ MethodInfo mi = typeof (InstanceDescriptor).GetProperty ("IsComplete").GetGetMethod ();
+ Assert.IsNotNull (mi, "IsComplete)");
+ Assert.IsTrue ((bool)mi.Invoke (id, null), "invoke");
+ }
+
+ [Test]
+ [PermissionSet (SecurityAction.PermitOnly, Unrestricted = true)]
+ public void Property_LinkDemand_PermitOnly_Unrestricted ()
+ {
+ InstanceDescriptor id = new InstanceDescriptor (null, new object[] { });
+ // denying anything -> not unrestricted
+ Type[] types = new Type[3] { typeof (MemberInfo), typeof (ICollection), typeof (bool) };
+ MethodInfo mi = typeof (InstanceDescriptor).GetProperty ("IsComplete").GetGetMethod ();
+ Assert.IsNotNull (mi, "IsComplete)");
+ Assert.IsTrue ((bool) mi.Invoke (id, null), "invoke");
+ }