public Intersect ( IPermission target ) : IPermission | ||
target | IPermission | |
return | IPermission |
public void IsSubset_Self () { SecurityPermission sp = new SecurityPermission (PermissionState.None); foreach (SecurityPermissionFlag spf in AllFlags) { sp.Flags = spf; SecurityPermission result = (SecurityPermission)sp.Intersect (sp); Assert.IsTrue (sp.IsSubsetOf (sp), spf.ToString ()); } }
public void Intersect_Unrestricted () { // Intersection with unrestricted == Copy // a. source (this) is unrestricted SecurityPermission sp1 = new SecurityPermission (PermissionState.Unrestricted); SecurityPermission sp2 = new SecurityPermission (PermissionState.None); foreach (SecurityPermissionFlag spf in AllFlagsExceptNoFlags) { sp2.Flags = spf; SecurityPermission result = (SecurityPermission) sp1.Intersect (sp2); Assert.AreEqual (sp2.Flags, result.Flags, "target " + spf.ToString ()); } // b. destination (target) is unrestricted foreach (SecurityPermissionFlag spf in AllFlagsExceptNoFlags) { sp2.Flags = spf; SecurityPermission result = (SecurityPermission)sp2.Intersect (sp1); Assert.AreEqual (sp2.Flags, result.Flags, "source " + spf.ToString ()); } // exceptions for NoFlags sp2.Flags = SecurityPermissionFlag.NoFlags; Assert.IsNull (sp1.Intersect (sp2), "target NoFlags"); Assert.IsNull (sp2.Intersect (sp1), "source NoFlags"); }
public void Intersect_None () { SecurityPermission sp1 = new SecurityPermission (PermissionState.None); SecurityPermission sp2 = new SecurityPermission (PermissionState.None); foreach (SecurityPermissionFlag spf in AllFlagsExceptNoFlags) { sp2.Flags = spf; // 1. Intersect None with spf SecurityPermission result = (SecurityPermission)sp1.Intersect (sp2); Assert.IsNull (result, "None N " + spf.ToString ()); // 2. Intersect spf with None result = (SecurityPermission)sp2.Intersect (sp1); Assert.IsNull (result, "None N " + spf.ToString ()); } }
public void Intersect_Self () { SecurityPermission sp = new SecurityPermission (PermissionState.None); foreach (SecurityPermissionFlag spf in AllFlagsExceptNoFlags) { sp.Flags = spf; SecurityPermission result = (SecurityPermission)sp.Intersect (sp); Assert.AreEqual (spf, result.Flags, spf.ToString ()); } }
public void Intersect_Null () { SecurityPermission sp = new SecurityPermission (PermissionState.None); // No intersection with null foreach (SecurityPermissionFlag spf in AllFlags) { sp.Flags = spf; Assert.IsNull (sp.Intersect (null), spf.ToString ()); } }