本文整理汇总了C#中SecurityZone.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SecurityZone.ToString方法的具体用法?C# SecurityZone.ToString怎么用?C# SecurityZone.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityZone
的用法示例。
在下文中一共展示了SecurityZone.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveEvidenceHost
private void ResolveEvidenceHost (SecurityZone zone, bool unrestricted, bool empty)
{
string prefix = zone.ToString () + "-";
Evidence e = new Evidence ();
e.AddHost (new Zone (zone));
PermissionSet ps = SecurityManager.ResolvePolicy (e);
// as 2.0 use Unrestricted for Identity permissions they have no need to be
// kept in resolved permission set
Assert.IsTrue ((unrestricted || (ps.Count > 0)), prefix + "Count");
Assert.AreEqual (empty, ps.IsEmpty (), prefix + "IsEmpty");
Assert.AreEqual (unrestricted, ps.IsUnrestricted (), prefix + "IsUnrestricted");
if (unrestricted)
Assert.IsNull (ps.GetPermission (typeof (ZoneIdentityPermission)), prefix + "GetPermission(ZoneIdentityPermission)");
else
Assert.IsNotNull (ps.GetPermission (typeof (ZoneIdentityPermission)), prefix + "GetPermission(ZoneIdentityPermission)");
}
示例2: Resolve_Zone
private void Resolve_Zone (PolicyLevel level, SecurityZone z, PolicyStatementAttribute attr, bool unrestricted, int count)
{
string prefix = z.ToString () + "-" + attr.ToString () + "-";
Evidence e = new Evidence ();
e.AddHost (new Zone (z));
PolicyStatement result = level.Resolve (e);
if (unrestricted) {
Assert.AreEqual (attr, result.Attributes, prefix + "Attributes");
switch (attr) {
case PolicyStatementAttribute.Nothing:
Assert.AreEqual (String.Empty, result.AttributeString, prefix + "AttributeString");
break;
case PolicyStatementAttribute.Exclusive:
Assert.AreEqual ("Exclusive", result.AttributeString, prefix + "AttributeString");
break;
case PolicyStatementAttribute.LevelFinal:
Assert.AreEqual ("LevelFinal", result.AttributeString, prefix + "AttributeString");
break;
case PolicyStatementAttribute.All:
Assert.AreEqual ("Exclusive LevelFinal", result.AttributeString, prefix + "AttributeString");
break;
}
}
else {
Assert.AreEqual (PolicyStatementAttribute.Nothing, result.Attributes, prefix + "Attributes");
Assert.AreEqual (String.Empty, result.AttributeString, prefix + "AttributeString");
}
Assert.AreEqual (unrestricted, result.PermissionSet.IsUnrestricted (), prefix + "IsUnrestricted");
Assert.AreEqual (count, result.PermissionSet.Count, prefix + "Count");
}
示例3: ResolveEvidenceAssembly
private void ResolveEvidenceAssembly (SecurityZone zone)
{
string prefix = zone.ToString () + "-";
Evidence e = new Evidence ();
e.AddAssembly (new Zone (zone));
PermissionSet ps = SecurityManager.ResolvePolicy (e);
Assert.AreEqual (0, ps.Count, prefix + "Count");
Assert.IsTrue (ps.IsEmpty (), prefix + "IsEmpty");
Assert.IsFalse (ps.IsUnrestricted (), prefix + "IsUnrestricted");
}