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


C# StorePermission.Copy方法代码示例

本文整理汇总了C#中System.Security.Permissions.StorePermission.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# StorePermission.Copy方法的具体用法?C# StorePermission.Copy怎么用?C# StorePermission.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Permissions.StorePermission的用法示例。


在下文中一共展示了StorePermission.Copy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PermissionState_None_Copy

		public void PermissionState_None_Copy ()
		{
			// both will return null under 2.0 final
			// StorePermission sp1 = new StorePermission (PermissionState.None).Copy();
			// StorePermission sp2 = new StorePermission (StorePermissionFlags.NoFlags).Copy ();
			StorePermission sp = new StorePermission (PermissionState.None);

			StorePermission copy = (StorePermission) sp.Copy ();
			Assert.IsFalse (Object.ReferenceEquals (sp, copy), "ReferenceEquals");
			Assert.AreEqual (sp.Flags, copy.Flags, "Copy Flags");
			Assert.AreEqual (sp.IsUnrestricted (), copy.IsUnrestricted (), "IsUnrestricted ()");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:StorePermissionTest.cs

示例2: ConstructorLevel_Deny_Unrestricted

		public void ConstructorLevel_Deny_Unrestricted ()
		{
			StorePermission p = new StorePermission (StorePermissionFlags.AllFlags);
			Assert.AreEqual (StorePermissionFlags.AllFlags, p.Flags, "Flags");
			Assert.IsTrue (p.IsUnrestricted (), "IsUnrestricted");
			Assert.IsNotNull (p.Copy (), "Copy");
			SecurityElement se = p.ToXml ();
			Assert.IsNotNull (se, "ToXml");
			p.FromXml (se);
			Assert.IsNotNull (p.Intersect (p), "Intersect");
			Assert.IsTrue (p.IsSubsetOf (p), "IsSubsetOf");
			Assert.IsNotNull (p.Union (p), "Union");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:StorePermissionCas.cs

示例3: ConstructorState_Deny_Unrestricted

		public void ConstructorState_Deny_Unrestricted ()
		{
			StorePermission p = new StorePermission (PermissionState.None);
			Assert.AreEqual (StorePermissionFlags.NoFlags, p.Flags, "Flags");
			Assert.IsFalse (p.IsUnrestricted (), "IsUnrestricted");
			SecurityElement se = p.ToXml ();
			Assert.IsNotNull (se, "ToXml");
			p.FromXml (se);
			Assert.IsTrue (p.IsSubsetOf (p), "IsSubsetOf");
			// strange behaviour of Copy under MS fx 2.0 (returns null for NoFlags)
			p.Copy ();
			p.Intersect (p);
			p.Union (p);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:14,代码来源:StorePermissionCas.cs

示例4: PermissionState_None

		public void PermissionState_None ()
		{
			PermissionState ps = PermissionState.None;
			StorePermission sp = new StorePermission (ps);
			Assert.AreEqual (StorePermissionFlags.NoFlags, sp.Flags, "Flags");
			Assert.IsFalse (sp.IsUnrestricted (), "IsUnrestricted");

			SecurityElement se = sp.ToXml ();
			// only class and version are present
			Assert.AreEqual ("NoFlags", se.Attribute ("Flags"), "Xml-Flags");
			Assert.IsNull (se.Children, "Xml-Children");

			StorePermission copy = (StorePermission) sp.Copy ();
			Assert.IsNull (copy, "Copy");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:StorePermissionTest.cs

示例5: PermissionState_Unrestricted

		public void PermissionState_Unrestricted ()
		{
			PermissionState ps = PermissionState.Unrestricted;
			StorePermission sp = new StorePermission (ps);
			Assert.AreEqual (StorePermissionFlags.AllFlags, sp.Flags, "Flags");
			Assert.IsTrue (sp.IsUnrestricted (), "IsUnrestricted");

			SecurityElement se = sp.ToXml ();
			Assert.IsNotNull (se.Attribute ("Unrestricted"), "Xml-Unrestricted");
			Assert.IsNull (se.Attribute ("Level"), "Xml-Flags");
			Assert.IsNull (se.Children, "Xml-Children");

			StorePermission copy = (StorePermission) sp.Copy ();
			Assert.IsFalse (Object.ReferenceEquals (sp, copy), "ReferenceEquals");
			Assert.AreEqual (sp.Flags, copy.Flags, "Copy Flags");
			Assert.AreEqual (sp.IsUnrestricted (), copy.IsUnrestricted (), "IsUnrestricted ()");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:17,代码来源:StorePermissionTest.cs

示例6: Copy

		public void Copy ()
		{
			StorePermission sp = new StorePermission (PermissionState.None);
			// i==0 would return null for MS
			for (int i=1; i < (int) StorePermissionFlags.AllFlags; i++) {
				// 8 isn't a valid value (so we exclude it from the rest of the loop)
				if ((i & 8) == 8)
					continue;
				sp.Flags = (StorePermissionFlags) i;
				StorePermission copy = (StorePermission) sp.Copy ();
				Assert.AreEqual (i, (int) copy.Flags, sp.Flags.ToString ());
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:StorePermissionTest.cs


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