本文整理汇总了C#中System.Security.Permissions.PrincipalPermission.IsSubsetOf方法的典型用法代码示例。如果您正苦于以下问题:C# PrincipalPermission.IsSubsetOf方法的具体用法?C# PrincipalPermission.IsSubsetOf怎么用?C# PrincipalPermission.IsSubsetOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Permissions.PrincipalPermission
的用法示例。
在下文中一共展示了PrincipalPermission.IsSubsetOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSubsetOfBadPermission
public void IsSubsetOfBadPermission ()
{
PrincipalPermission p1 = new PrincipalPermission ("user", null);
EnvironmentPermission ep2 = new EnvironmentPermission (PermissionState.Unrestricted);
Assert ("IsSubsetOf(EnvironmentPermission)", p1.IsSubsetOf (ep2));
}
示例2: IsSubsetOf
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));
}
示例3: IsSubsetOfNull
public void IsSubsetOfNull ()
{
PrincipalPermission p = new PrincipalPermission ("user", null);
Assert ("User.IsSubsetOf(null)", !p.IsSubsetOf (null));
}
示例4: IsSubsetOfUnrestricted
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));
}
示例5: IsSubsetOfNone
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)");
}