コード例 #1
0
        public void ToXml()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            Assert.AreEqual("IMembershipCondition", se.Tag, "Tag");
            Assert.IsTrue(se.Attribute("class").StartsWith("System.Security.Policy.DomainApplicationMembershipCondition"), "class");
            Assert.AreEqual("1", se.Attribute("version"), "version");
            Assert.AreEqual(se.ToString(), domapp.ToXml(null).ToString(), "ToXml(null)");
            Assert.AreEqual(se.ToString(), domapp.ToXml(PolicyLevel.CreateAppDomainLevel()).ToString(), "ToXml(PolicyLevel)");
        }
コード例 #2
0
        public void FromXml()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            domapp.FromXml(se);
        }
コード例 #3
0
        public void FromXml_InvalidClass()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            se.Attributes ["class"] = "Hello world";
            domapp.FromXml(se);
        }
コード例 #4
0
        public void FromXml_WrongTagCase()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            se.Tag = "IMEMBERSHIPCONDITION";             // instedomapp of IMembershipCondition
            domapp.FromXml(se);
        }
コード例 #5
0
        public void FromXml_InvalidTag()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            se.Tag = "IMonoship";
            domapp.FromXml(se);
        }
コード例 #6
0
        public void FromXml_NoVersion()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            SecurityElement w = new SecurityElement(se.Tag);

            w.AddAttribute("class", se.Attribute("class"));
            domapp.FromXml(w);
        }
コード例 #7
0
        public void FromXml_NoClass()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            SecurityElement w = new SecurityElement(se.Tag);

            w.AddAttribute("version", se.Attribute("version"));
            domapp.FromXml(w);
            // doesn't even care of the class attribute presence
        }
コード例 #8
0
        public void FromXml_InvalidVersion()
        {
            DomainApplicationMembershipCondition domapp = new DomainApplicationMembershipCondition();
            SecurityElement se = domapp.ToXml();

            SecurityElement w = new SecurityElement(se.Tag);

            w.AddAttribute("class", se.Attribute("class"));
            w.AddAttribute("version", "2");
            domapp.FromXml(w);
            // doesn't seems to care about the version number!
        }