Union() public method

public Union ( IPermission target ) : IPermission
target IPermission
return IPermission
		public void Union_Self ()
		{
			SecurityPermission sp = new SecurityPermission (PermissionState.None);
			foreach (SecurityPermissionFlag spf in AllFlags) {
				sp.Flags = spf;
				SecurityPermission result = (SecurityPermission)sp.Union (sp);
				Assert.AreEqual (spf, result.Flags, spf.ToString ());
			}
		}
		public void Union_Unrestricted ()
		{
			// Union with unrestricted is unrestricted
			SecurityPermission sp1 = new SecurityPermission (PermissionState.Unrestricted);
			SecurityPermission sp2 = new SecurityPermission (PermissionState.None);
			// a. source (this) is unrestricted
			foreach (SecurityPermissionFlag spf in AllFlags) {
				sp2.Flags = spf;
				SecurityPermission union = (SecurityPermission)sp1.Union (sp2);
				Assert.IsTrue (union.IsUnrestricted (), "target " + spf.ToString ());
			}
			// b. destination (target) is unrestricted
			foreach (SecurityPermissionFlag spf in AllFlags) {
				sp2.Flags = spf;
				SecurityPermission union = (SecurityPermission)sp2.Union (sp1);
				Assert.IsTrue (union.IsUnrestricted (), "source " + spf.ToString ());
			}
		}
		public void Union_Null ()
		{
			SecurityPermission sp = new SecurityPermission (PermissionState.None);
			// Union with null is a simple copy
			foreach (SecurityPermissionFlag spf in AllFlags) {
				sp.Flags = spf;
				SecurityPermission union = (SecurityPermission) sp.Union (null);
				Assert.AreEqual (spf, union.Flags, spf.ToString ());
			}
		}