public ResolveMatchingCodeGroups ( |
||
evidence | ||
Результат |
public static void FileCodeGroupCallMethods() { FileCodeGroup fcg = new FileCodeGroup(new GacMembershipCondition(), new FileIOPermissionAccess()); CodeGroup cg = fcg.Copy(); bool equals = fcg.Equals(new object()); int hash = fcg.GetHashCode(); PolicyStatement ps = fcg.Resolve(new Evidence()); cg = fcg.ResolveMatchingCodeGroups(new Evidence()); }
public void ResolveMatchingCodeGroups_ThreeLevel () { FileCodeGroup level1 = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess); CodeGroup level2 = level1.Copy (); level1.AddChild (level2); FileCodeGroup level3 = new FileCodeGroup (new ZoneMembershipCondition (SecurityZone.Untrusted), FileIOPermissionAccess.AllAccess); level2.AddChild (level3); CodeGroup match = level1.ResolveMatchingCodeGroups (new Evidence ()); Assert.IsNotNull (match, "Match"); Assert.IsTrue (match.Equals (level1, false), "Equals(false)"); // Equals (true) isn't a deep compare (just one level) Assert.IsTrue (match.Equals (level1, true), "Equals(true)"); }
public void ResolveMatchingCodeGroups_TwoLevel () { FileCodeGroup level1 = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess); CodeGroup level2 = level1.Copy (); level1.AddChild (level2); CodeGroup match = level1.ResolveMatchingCodeGroups (new Evidence ()); Assert.IsNotNull (match, "Match"); Assert.IsTrue (match.Equals (level1, false), "Equals(false)"); Assert.IsTrue (match.Equals (level1, true), "Equals(true)"); FileCodeGroup level2b = new FileCodeGroup (new ZoneMembershipCondition (SecurityZone.Untrusted), FileIOPermissionAccess.AllAccess); level1.AddChild (level2b); CodeGroup match2 = level1.ResolveMatchingCodeGroups (new Evidence ()); Assert.IsNotNull (match2, "Match2"); Assert.IsTrue (match2.Equals (level1, false), "Equals(false)"); Assert.IsTrue (!match2.Equals (level1, true), "Equals(true)"); }
public void ResolveMatchingCodeGroups_OneLevel () { FileCodeGroup level1 = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess); CodeGroup match = level1.ResolveMatchingCodeGroups (new Evidence ()); Assert.IsNotNull (match, "Match"); Assert.IsTrue (match.Equals (level1, false), "Equals(false)"); Assert.IsTrue (match.Equals (level1, true), "Equals(true)"); }
public void ResolveMatchingCodeGroups_NoMatch () { FileCodeGroup cg = new FileCodeGroup (new ZoneMembershipCondition (SecurityZone.Untrusted), FileIOPermissionAccess.AllAccess); Assert.IsNull (cg.ResolveMatchingCodeGroups (new Evidence ())); }
public void ResolveMatchingCodeGroups_Null () { FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess); cg.ResolveMatchingCodeGroups (null); }