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


C# IsolatedStorageFilePermission.Union方法代码示例

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


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

示例1: Union_DifferentPermissions

		public void Union_DifferentPermissions ()
		{
			IsolatedStorageFilePermission a = new IsolatedStorageFilePermission (PermissionState.None);
			SecurityPermission b = new SecurityPermission (PermissionState.None);
			a.Union (b);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:6,代码来源:IsolatedStorageFilePermissionTest.cs

示例2: UsageAllowedQuota

		public void UsageAllowedQuota ()
		{
			IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
			IsolatedStorageFilePermission small = new IsolatedStorageFilePermission (PermissionState.None);
			small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
			small.UserQuota = 1;
			IsolatedStorageFilePermission union = (IsolatedStorageFilePermission)empty.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByUser, union.UsageAllowed, "DomainIsolationByUser");
			Assert.AreEqual (1, union.UserQuota, "1");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-1");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-1a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-1b");
			Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-1c");
			IsolatedStorageFilePermission intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-1");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-1");

			small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser;
			small.UserQuota = 2;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByUser, union.UsageAllowed, "AssemblyIsolationByUser");
			Assert.AreEqual (2, union.UserQuota, "2");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-2");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-2a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-2b");
			Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-2c");
			intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-2");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-2");
			small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByUser;
			small.UserQuota = 3;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByUser, union.UsageAllowed, "ApplicationIsolationByUser");
			Assert.AreEqual (3, union.UserQuota, "3");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-3");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-3a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-3b");
			Assert.IsFalse (union.IsSubsetOf (small), "IsSubset-3c");
			intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-3");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-3");

			small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByMachine;
			small.UserQuota = 4;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByMachine, union.UsageAllowed, "DomainIsolationByMachine");
			Assert.AreEqual (4, union.UserQuota, "4");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-4");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-4a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-4b");
			Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-4c");
			intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-4");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-4");

			small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByMachine;
			small.UserQuota = 5;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByMachine, union.UsageAllowed, "AssemblyIsolationByMachine");
			Assert.AreEqual (5, union.UserQuota, "5");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-5");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-5a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-5b");
			Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-5c");
			intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-5");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-5");

			small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByMachine;
			small.UserQuota = 6;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.ApplicationIsolationByMachine, union.UsageAllowed, "ApplicationIsolationByMachine");
			Assert.AreEqual (6, union.UserQuota, "6");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-6");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-6a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-6b");
			Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-6c");
			intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-6");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-6");
			small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByRoamingUser;
			small.UserQuota = 7;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByRoamingUser, union.UsageAllowed, "DomainIsolationByRoamingUser");
			Assert.AreEqual (7, union.UserQuota, "7a");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7a");
			Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-7a");
			Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-7b");
			Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-7c");
			intersect = (IsolatedStorageFilePermission)union.Intersect (small);
			Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-7");
			Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-7");

			// can't go back ;-)
			small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
			small.UserQuota = 1;
			union = (IsolatedStorageFilePermission)union.Union (small);
			Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByRoamingUser, union.UsageAllowed, "DomainIsolationByRoamingUser");
			Assert.AreEqual (7, union.UserQuota, "7b");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7b");
//.........这里部分代码省略.........
开发者ID:Profit0004,项目名称:mono,代码行数:101,代码来源:IsolatedStorageFilePermissionTest.cs

示例3: Union

		public void Union ()
		{
			IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
			IsolatedStorageFilePermission union = (IsolatedStorageFilePermission)empty.Union (null);
			Assert.IsNotNull (union, "empty U null");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-1");
			Assert.IsFalse (Object.ReferenceEquals (empty, union), "ReferenceEquals-1");

			union = (IsolatedStorageFilePermission)empty.Union (empty);
			Assert.IsNotNull (union, "empty U empty");
			Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-2");
			Assert.IsFalse (Object.ReferenceEquals (empty, union), "ReferenceEquals-2");

			IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
			union = (IsolatedStorageFilePermission)unrestricted.Union (null);
			Assert.IsNotNull (union, "unrestricted U null");
			Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-3");
			Assert.IsFalse (Object.ReferenceEquals (unrestricted, union), "ReferenceEquals-3");

			union = (IsolatedStorageFilePermission)unrestricted.Union (empty);
			Assert.IsNotNull (union, "unrestricted U empty");
			Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-4");
			Assert.IsFalse (Object.ReferenceEquals (unrestricted, union), "ReferenceEquals-4");

			union = (IsolatedStorageFilePermission)unrestricted.Union (unrestricted);
			Assert.IsNotNull (union, "unrestricted U unrestricted");
			Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-5");
			Assert.IsFalse (Object.ReferenceEquals (unrestricted, union), "ReferenceEquals-5");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:29,代码来源:IsolatedStorageFilePermissionTest.cs


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