IsSubsetOf() public method

public IsSubsetOf ( IPermission target ) : bool
target IPermission
return bool
		public void IsSubsetOfBadPermission () 
		{
			PrincipalPermission p1 = new PrincipalPermission ("user", null);
			EnvironmentPermission ep2 = new EnvironmentPermission (PermissionState.Unrestricted);
			Assert ("IsSubsetOf(EnvironmentPermission)", p1.IsSubsetOf (ep2));
		}
		public void IsSubsetOf () 
		{
			PrincipalPermission p1 = new PrincipalPermission ("user A", "role 1");
			PrincipalPermission p2 = new PrincipalPermission (null, "role 1");
			Assert ("UserRole.IsSubsetOf(Role)", p1.IsSubsetOf (p2));
			Assert ("Role.IsSubsetOf(UserRole)", !p2.IsSubsetOf (p1));

			PrincipalPermission p3 = new PrincipalPermission ("user A", "role 1", false);
			Assert ("UserRoleAuth.IsSubsetOf(UserRoleNA)", !p3.IsSubsetOf (p1));
			Assert ("UserRoleNA.IsSubsetOf(UserRoleAuth)", !p1.IsSubsetOf (p3));

			PrincipalPermission p4 = new PrincipalPermission (null, null, true); // unrestricted
			Assert ("unrestricted.IsSubsetOf(UserRole)", !p4.IsSubsetOf (p1));
			Assert ("UserRole.IsSubsetOf(unrestricted)", p1.IsSubsetOf (p4));
		}
		public void IsSubsetOfNull () 
		{
			PrincipalPermission p = new PrincipalPermission ("user", null);
			Assert ("User.IsSubsetOf(null)", !p.IsSubsetOf (null));
		}
		public void IsSubsetOfUnrestricted () 
		{
			PrincipalPermission p1 = new PrincipalPermission (PermissionState.Unrestricted);
			PrincipalPermission p2 = new PrincipalPermission ("user", "role", false);
			Assert ("Unrestricted.IsSubsetOf(user)", !p1.IsSubsetOf (p2));
			Assert ("user.IsSubsetOf(Unrestricted)", p2.IsSubsetOf (p1));
		}
Example #5
0
		public void IsSubsetOfNone ()
		{
			PrincipalPermission none = new PrincipalPermission (PermissionState.None);
			PrincipalPermission p = new PrincipalPermission ("user", null);
			Assert.IsTrue (!p.IsSubsetOf (none), "User.IsSubsetOf(null)");

			p = new PrincipalPermission (PermissionState.None);
			Assert.IsTrue (p.IsSubsetOf (none), "None.IsSubsetOf(null)");

			p = new PrincipalPermission (PermissionState.Unrestricted);
			Assert.IsTrue (!p.IsSubsetOf (none), "Unrestricted.IsSubsetOf(null)");
		}