Intersect() public method

public Intersect ( IPermission target ) : IPermission
target IPermission
return IPermission
		public void Intersect_DifferentPermissions ()
		{
			UIPermission a = new UIPermission (PermissionState.None);
			SecurityPermission b = new SecurityPermission (PermissionState.None);
			a.Intersect (b);
		}
		public void Intersect ()
		{
			UIPermission clip_all = new UIPermission (UIPermissionClipboard.AllClipboard);
			UIPermission clip_own = new UIPermission (UIPermissionClipboard.OwnClipboard);
			UIPermission intersect = (UIPermission)clip_all.Intersect (clip_own);
			Compare (clip_own, intersect, "clip_all N clip_own");
			Assert.IsFalse (Object.ReferenceEquals (clip_own, intersect), "!ReferenceEquals1");
			Assert.IsTrue (intersect.IsSubsetOf (clip_all), "intersect.IsSubsetOf (clip_all)");
			Assert.IsTrue (intersect.IsSubsetOf (clip_own), "intersect.IsSubsetOf (clip_own)");

			UIPermission win_all = new UIPermission (UIPermissionWindow.AllWindows);
			UIPermission win_safe = new UIPermission (UIPermissionWindow.SafeSubWindows);
			intersect = (UIPermission) win_all.Intersect (win_safe);
			Compare (win_safe, intersect, "win_all N win_safe");
			Assert.IsFalse (Object.ReferenceEquals (win_safe, intersect), "!ReferenceEquals2");
			Assert.IsTrue (intersect.IsSubsetOf (win_all), "intersect.IsSubsetOf (win_all)");
			Assert.IsTrue (intersect.IsSubsetOf (win_safe), "intersect.IsSubsetOf (win_safe)");

			intersect = (UIPermission)win_all.Intersect (clip_all);
			Assert.IsNull (intersect, "win_all N clip_all");

			intersect = (UIPermission)win_all.Intersect (null);
			Assert.IsNull (intersect, "win_all N null");

			intersect = (UIPermission)clip_all.Intersect (null);
			Assert.IsNull (intersect, "clip_all N null");

			UIPermission empty = new UIPermission (PermissionState.None);
			intersect = (UIPermission)clip_all.Intersect (empty);
			Assert.IsNull (intersect, "clip_all N null");

			UIPermission unrestricted = new UIPermission (PermissionState.Unrestricted);
			intersect = (UIPermission)clip_all.Intersect (unrestricted);
			Compare (clip_all, intersect, "clip_all N unrestricted");
			Assert.IsFalse (Object.ReferenceEquals (clip_all, intersect), "!ReferenceEquals4");
			Assert.IsTrue (intersect.IsSubsetOf (clip_all), "intersect.IsSubsetOf (clip_all)");
			Assert.IsTrue (intersect.IsSubsetOf (unrestricted), "intersect.IsSubsetOf (unrestricted)");
		}