Esempio n. 1
0
        public void FromXml_WrongVersion()
        {
            SmtpPermission  sp = new SmtpPermission(PermissionState.None);
            SecurityElement se = sp.ToXml();

            se.Attributes.Remove("version");
            se.Attributes.Add("version", "2");
            sp.FromXml(se);
        }
Esempio n. 2
0
        public void FromXml_NoVersion()
        {
            SmtpPermission  sp = new SmtpPermission(PermissionState.None);
            SecurityElement se = sp.ToXml();

            SecurityElement w = new SecurityElement(se.Tag);

            w.AddAttribute("class", se.Attribute("class"));
            sp.FromXml(w);
        }
Esempio n. 3
0
        public void FromXml_WrongTagCase()
        {
            SmtpPermission  sp = new SmtpPermission(PermissionState.None);
            SecurityElement se = sp.ToXml();

            se.Tag = "IPERMISSION";             // instead of IPermission
            sp.FromXml(se);
            // note: normally IPermission classes (in corlib) DO care about the
            // IPermission tag
        }
Esempio n. 4
0
        public void FromXml_NoClass()
        {
            SmtpPermission  sp = new SmtpPermission(PermissionState.None);
            SecurityElement se = sp.ToXml();

            SecurityElement w = new SecurityElement(se.Tag);

            w.AddAttribute("version", se.Attribute("version"));
            sp.FromXml(w);
            // note: normally IPermission classes (in corlib) DO NOT care about
            // attribute "class" name presence in the XML
        }
Esempio n. 5
0
        public void FromXml_WrongClass()
        {
            SmtpPermission  sp = new SmtpPermission(PermissionState.None);
            SecurityElement se = sp.ToXml();

            SecurityElement w = new SecurityElement(se.Tag);

            w.AddAttribute("class", "Wrong" + se.Attribute("class"));
            w.AddAttribute("version", se.Attribute("version"));
            sp.FromXml(w);
            // doesn't care of the class name at that stage
            // anyway the class has already be created so...
        }
Esempio n. 6
0
        public void FromXml_Null()
        {
            SmtpPermission sp = new SmtpPermission(PermissionState.None);

            sp.FromXml(null);
        }