Пример #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 Intersect_Unrestricted ()
		{
			// Intersection with unrestricted == Copy
			// a. source (this) is unrestricted
			PrintingPermission sp1 = new PrintingPermission (PermissionState.Unrestricted);
			PrintingPermission sp2 = new PrintingPermission (PermissionState.None);
			foreach (PrintingPermissionLevel ppl in AllLevelExceptNoLevel) {
				sp2.Level = ppl;
				PrintingPermission result = (PrintingPermission)sp1.Intersect (sp2);
				Assert.AreEqual (sp2.Level, result.Level, "target " + ppl.ToString ());
			}
			// b. destination (target) is unrestricted
			foreach (PrintingPermissionLevel ppl in AllLevelExceptNoLevel) {
				sp2.Level = ppl;
				PrintingPermission result = (PrintingPermission)sp2.Intersect (sp1);
				Assert.AreEqual (sp2.Level, result.Level, "source " + ppl.ToString ());
			}
			// exceptions for NoLevel
			sp2.Level = PrintingPermissionLevel.NoPrinting;
			Assert.IsNull (sp1.Intersect (sp2), "target NoLevel");
			Assert.IsNull (sp2.Intersect (sp1), "source NoLevel");
		}
Пример #3
0
		public void Intersect_None ()
		{
			PrintingPermission sp1 = new PrintingPermission (PermissionState.None);
			PrintingPermission sp2 = new PrintingPermission (PermissionState.None);
			foreach (PrintingPermissionLevel ppl in AllLevelExceptNoLevel) {
				sp2.Level = ppl;
				// 1. Intersect None with ppl
				PrintingPermission result = (PrintingPermission)sp1.Intersect (sp2);
				Assert.IsNull (result, "None N " + ppl.ToString ());
				// 2. Intersect ppl with None
				result = (PrintingPermission)sp2.Intersect (sp1);
				Assert.IsNull (result, "None N " + ppl.ToString ());
			}
		}
Пример #4
0
		public void Intersect_Self ()
		{
			PrintingPermission pp = new PrintingPermission (PermissionState.None);
			foreach (PrintingPermissionLevel ppl in AllLevelExceptNoLevel) {
				pp.Level = ppl;
				PrintingPermission result = (PrintingPermission)pp.Intersect (pp);
				Assert.AreEqual (ppl, result.Level, ppl.ToString ());
			}
		}
Пример #5
0
		public void Intersect_Null ()
		{
			PrintingPermission pp = new PrintingPermission (PermissionState.None);
			// No intersection with null
			foreach (PrintingPermissionLevel ppl in AllLevel) {
				pp.Level = ppl;
				Assert.IsNull (pp.Intersect (null), ppl.ToString ());
			}
		}