Beispiel #1
0
        public static void UnionCodeGroupCallMethods()
        {
            UnionCodeGroup  ucg = new UnionCodeGroup(new GacMembershipCondition(), new PolicyStatement(new PermissionSet(new PermissionState())));
            CodeGroup       cg  = ucg.Copy();
            PolicyStatement ps  = ucg.Resolve(new Evidence());

            cg = ucg.ResolveMatchingCodeGroups(new Evidence());
        }
Beispiel #2
0
        public void ResolveMatchingCodeGroups_OneLevel()
        {
            UnionCodeGroup level1 = new UnionCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
            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)");
        }
Beispiel #3
0
        public void ResolveMatchingCodeGroups_TwoLevel()
        {
            UnionCodeGroup level1 = new UnionCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
            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)");

            UnionCodeGroup level2b = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Untrusted), new PolicyStatement(new PermissionSet(PermissionState.Unrestricted)));

            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)");
        }
Beispiel #4
0
        public void ResolveMatchingCodeGroups_NoMatch()
        {
            UnionCodeGroup cg = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Untrusted), new PolicyStatement(new PermissionSet(PermissionState.Unrestricted)));

            Assert.IsNull(cg.ResolveMatchingCodeGroups(new Evidence()));
        }
Beispiel #5
0
        public void ResolveMatchingCodeGroups_Null()
        {
            UnionCodeGroup cg = new UnionCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));

            cg.ResolveMatchingCodeGroups(null);
        }