FromXml() public method

public FromXml ( SecurityElement securityElement ) : void
securityElement System.Security.SecurityElement
return void
		private void CommonTests (AspNetHostingPermission p)
		{
			Assert.IsNotNull (p.Copy (), "Copy");
			SecurityElement se = p.ToXml ();
			Assert.IsNotNull (se, "ToXml");
			p.FromXml (se);
			Assert.IsNotNull (p.Intersect (p), "Intersect");
			Assert.IsTrue (p.IsSubsetOf (p), "IsSubsetOf");
			Assert.IsNotNull (p.Union (p), "Union");
		}
		public void FromXml_NoVersion ()
		{
			AspNetHostingPermission anhp = new AspNetHostingPermission (PermissionState.None);
			SecurityElement se = anhp.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("class", se.Attribute ("class"));
			anhp.FromXml (w);
		}
		public void FromXml_WrongVersion ()
		{
			AspNetHostingPermission anhp = new AspNetHostingPermission (PermissionState.None);
			SecurityElement se = anhp.ToXml ();
			se.Attributes.Remove ("version");
			se.Attributes.Add ("version", "2");
			anhp.FromXml (se);
		}
		public void FromXml_NoClass ()
		{
			AspNetHostingPermission anhp = new AspNetHostingPermission (PermissionState.None);
			SecurityElement se = anhp.ToXml ();

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

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("class", "Wrong" + se.Attribute ("class"));
			w.AddAttribute ("version", se.Attribute ("version"));
			anhp.FromXml (w);
			// doesn't care of the class name at that stage
			// anyway the class has already be created so...
		}
		public void FromXml_WrongTagCase ()
		{
			AspNetHostingPermission anhp = new AspNetHostingPermission (PermissionState.None);
			SecurityElement se = anhp.ToXml ();
			se.Tag = "IPERMISSION"; // instead of IPermission
			anhp.FromXml (se);
			// note: normally IPermission classes (in corlib) DO care about the
			// IPermission tag
		}
		public void FromXml_Null ()
		{
			AspNetHostingPermission anhp = new AspNetHostingPermission (PermissionState.None);
			anhp.FromXml (null);
		}