Union() public method

public Union ( IPermission target ) : IPermission
target IPermission
return IPermission
コード例 #1
0
		public void Union_BadPermission ()
		{
			DnsPermission dp = new DnsPermission (PermissionState.None);
			dp.Union (new SecurityPermission (PermissionState.Unrestricted));
		}
コード例 #2
0
		public void Union ()
		{
			DnsPermission dpn = new DnsPermission (PermissionState.None);
			DnsPermission dpu = new DnsPermission (PermissionState.Unrestricted);
			
			DnsPermission result = (DnsPermission) dpn.Union (null);
			Assert.IsFalse (result.IsUnrestricted (), "None U null");
			
			result = (DnsPermission) dpu.Union (null);
			Assert.IsTrue (result.IsUnrestricted (), "Unrestricted U null");

			result = (DnsPermission) dpn.Union (dpn);
			Assert.IsFalse (result.IsUnrestricted (), "None U None");

			result = (DnsPermission) dpu.Union (dpu);
			Assert.IsTrue (result.IsUnrestricted (), "Unrestricted U Unrestricted");

			result = (DnsPermission) dpn.Union (dpu);
			Assert.IsTrue (result.IsUnrestricted (), "None U Unrestricted");

			result = (DnsPermission) dpu.Union (dpn);
			Assert.IsTrue (result.IsUnrestricted (), "Unrestricted U None");
		}