当前位置: 首页>>代码示例>>C#>>正文


C# SecurityZone.ToString方法代码示例

本文整理汇总了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)");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:SecurityManagerTest.cs

示例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");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:30,代码来源:PolicyLevelTest.cs

示例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");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:SecurityManagerTest.cs


注:本文中的SecurityZone.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。