Exemplo n.º 1
0
        public void Check()
        {
            SiteMembershipCondition smc = new SiteMembershipCondition("*.go-mono.com");

            Evidence e = null;

            Assert.IsFalse(smc.Check(e), "Check(null)");
            e = new Evidence();
            Assert.IsFalse(smc.Check(e), "Check (empty)");
            e.AddHost(new Zone(SecurityZone.MyComputer));
            Assert.IsFalse(smc.Check(e), "Check (zone)");

            Site s = new Site("*.go-mono.com");

            e.AddAssembly(s);
            Assert.IsFalse(smc.Check(e), "Check (site-assembly)");
            e.AddHost(s);
            Assert.IsTrue(smc.Check(e), "Check (site-host)");

            e = new Evidence();
            e.AddHost(new Site("www.go-mono.com"));
            Assert.IsTrue(smc.Check(e), "Check(+-)");

            e = new Evidence();
            e.AddHost(new Site("*.go-mono.org"));
            Assert.IsFalse(smc.Check(e), "Check(-)");
        }
        public static void SiteMembershipConditionCallMethods()
        {
            SiteMembershipCondition smc = new SiteMembershipCondition("test");
            bool check = smc.Check(new Evidence());
            IMembershipCondition obj = smc.Copy();

            check = smc.Equals(new object());
            int             hash = smc.GetHashCode();
            string          str  = smc.ToString();
            SecurityElement se   = new SecurityElement("");
            PolicyLevel     pl   = (PolicyLevel)FormatterServices.GetUninitializedObject(typeof(PolicyLevel));

            smc.FromXml(se);
            smc.FromXml(se, pl);
            se = smc.ToXml();
            se = smc.ToXml(pl);
        }
Exemplo n.º 3
0
        public static void SiteMembershipConditionCallMethods()
        {
            SiteMembershipCondition smc = new SiteMembershipCondition("test");
            bool check = smc.Check(new Evidence());
            IMembershipCondition obj = smc.Copy();

            check = smc.Equals(new object());
            int             hash = smc.GetHashCode();
            string          str  = smc.ToString();
            SecurityElement se   = new SecurityElement("");
            PolicyLevel     pl   = (PolicyLevel)Activator.CreateInstance(typeof(PolicyLevel), true);

            smc.FromXml(se);
            smc.FromXml(se, pl);
            se = smc.ToXml();
            se = smc.ToXml(pl);
        }