コード例 #1
0
		public void IsSubset_Self ()
		{
			PrintingPermission pp = new PrintingPermission (PermissionState.None);
			foreach (PrintingPermissionLevel ppl in AllLevel) {
				pp.Level = ppl;
				PrintingPermission result = (PrintingPermission)pp.Intersect (pp);
				Assert.IsTrue (pp.IsSubsetOf (pp), ppl.ToString ());
			}
		}
コード例 #2
0
		public void IsSubset_Unrestricted ()
		{
			// IsSubset with unrestricted
			// a. source (this) is unrestricted -> target is never a subset
			PrintingPermission sp1 = new PrintingPermission (PermissionState.Unrestricted);
			PrintingPermission sp2 = new PrintingPermission (PermissionState.None);
			foreach (PrintingPermissionLevel ppl in AllLevelExceptAllLevel) {
				sp2.Level = ppl;
				Assert.IsFalse (sp1.IsSubsetOf (sp2), "target " + ppl.ToString ());
			}
			// exception of AllLevel
			sp2.Level = PrintingPermissionLevel.AllPrinting;
			Assert.IsTrue (sp1.IsSubsetOf (sp2), "target AllLevel");
			// b. destination (target) is unrestricted -> target is always a subset
			foreach (PrintingPermissionLevel ppl in AllLevel) {
				sp2.Level = ppl;
				Assert.IsTrue (sp2.IsSubsetOf (sp1), "source " + ppl.ToString ());
			}
		}
コード例 #3
0
		public void IsSubset_Null ()
		{
			PrintingPermission pp = new PrintingPermission (PermissionState.None);
			Assert.IsTrue (pp.IsSubsetOf (null), "NoLevel");
			foreach (PrintingPermissionLevel ppl in AllLevelExceptNoLevel) {
				pp.Level = ppl;
				Assert.IsFalse (pp.IsSubsetOf (null), ppl.ToString ());
			}
		}