Union() public method

public Union ( IPermission other ) : IPermission
other IPermission
return IPermission
コード例 #1
0
		public void UnionWithBadPermission () 
		{
			ReflectionPermission p1 = new ReflectionPermission (ReflectionPermissionFlag.NoFlags);
			EnvironmentPermission ep2 = new EnvironmentPermission (PermissionState.Unrestricted);
			ReflectionPermission p3 = (ReflectionPermission) p1.Union (ep2);
		}
コード例 #2
0
		public void UnionWithUnrestricted () 
		{
			ReflectionPermission p1 = new ReflectionPermission (PermissionState.Unrestricted);
			ReflectionPermission p2 = new ReflectionPermission (ReflectionPermissionFlag.NoFlags);
			ReflectionPermission p3 = (ReflectionPermission) p1.Union (p2);
			Assert.IsTrue (p3.IsUnrestricted (), "Unrestricted U P2 == Unrestricted");
			p3 = (ReflectionPermission) p2.Union (p1);
			Assert.IsTrue (p3.IsUnrestricted (), "P2 U Unrestricted == Unrestricted");
		}
コード例 #3
0
		public void Union () 
		{
			ReflectionPermission p1 = new ReflectionPermission (ReflectionPermissionFlag.TypeInformation);
			ReflectionPermission p2 = new ReflectionPermission (ReflectionPermissionFlag.MemberAccess);
			ReflectionPermission p3 = (ReflectionPermission) p1.Union (p2);
			Assert.AreEqual (ReflectionPermissionFlag.MemberAccess | ReflectionPermissionFlag.TypeInformation, p3.Flags);
			ReflectionPermission p4 = new ReflectionPermission (ReflectionPermissionFlag.ReflectionEmit);
			ReflectionPermission p5 = (ReflectionPermission) p4.Union (p3);
			Assert.IsTrue (p5.IsUnrestricted (), "P3 U P4==Unrestricted");
		}
コード例 #4
0
		public void UnionWithNull () 
		{
			ReflectionPermission p1 = new ReflectionPermission (ReflectionPermissionFlag.NoFlags);
			ReflectionPermission p2 = null;
			ReflectionPermission p3 = (ReflectionPermission) p1.Union (p2);
			Assert.AreEqual (p1.ToXml ().ToString (), p3.ToXml ().ToString (), "P1 U null == P1");
		}