FromXml() public method

public FromXml ( SecurityElement e ) : void
e SecurityElement
return void
		public void UrlMembershipCondition_GoMonoWebUrl () 
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com/");
			Assert.AreEqual ("http://www.go-mono.com/", umc.Url, "Url");
			Assert.AreEqual ("Url - http://www.go-mono.com/", umc.ToString (), "ToString");

			UrlMembershipCondition umc2 = (UrlMembershipCondition) umc.Copy ();
			Assert.AreEqual (umc.Url, umc2.Url, "Copy.Url");
			Assert.AreEqual (umc.GetHashCode (), umc2.GetHashCode (), "Copy.GetHashCode");

			SecurityElement se = umc2.ToXml ();
			UrlMembershipCondition umc3 = new UrlMembershipCondition ("*");
			umc3.FromXml (se);
			Assert.AreEqual (umc.Url, umc3.Url, "ToXml/FromXml");

			Assert.IsTrue (umc.Equals (umc2), "Equals");
			UrlMembershipCondition umc4 = new UrlMembershipCondition ("http://www.go-mono.com");
			// note that a last slash is added to Url - so it's equal
			Assert.IsTrue (umc.Equals (umc4), "Equals-AutoAddedLastSlash");
		}
		public void Url_AllGoMonoUrl () 
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com/*");
			Assert.AreEqual ("http://www.go-mono.com/*", umc.Url, "Url");
			Assert.AreEqual ("Url - http://www.go-mono.com/*", umc.ToString (), "ToString");

			UrlMembershipCondition umc2 = (UrlMembershipCondition) umc.Copy ();
			Assert.AreEqual (umc.Url, umc2.Url, "Copy.Url");
			Assert.AreEqual (umc.GetHashCode (), umc2.GetHashCode (), "Copy.GetHashCode");

			SecurityElement se = umc2.ToXml ();
			UrlMembershipCondition umc3 = new UrlMembershipCondition ("*");
			umc3.FromXml (se);
			Assert.AreEqual (umc.Url, umc3.Url, "ToXml/FromXml");

			Assert.IsTrue (umc.Equals (umc2), "Equals");
			UrlMembershipCondition umc4 = new UrlMembershipCondition ("http://www.go-mono.com/");
			Assert.IsTrue (umc.Equals (umc4), "Equals-*");
		}
		public void ToXml_PolicyLevel () 
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
			SecurityElement se = umc.ToXml ();
			string s = umc.ToXml ().ToString ();
			// is it accepted for all policy levels ?
			IEnumerator e = SecurityManager.PolicyHierarchy ();
			while (e.MoveNext ()) {
				PolicyLevel pl = e.Current as PolicyLevel;
				UrlMembershipCondition spl = new UrlMembershipCondition ("*");
				spl.FromXml (se, pl);
				Assert.AreEqual (s, spl.ToXml (pl).ToString (), "ToXml(PolicyLevel='" + pl.Label + "')");
			}
			// yes!
		}
		public void ToFromXmlRoundTrip () 
		{
			UrlMembershipCondition umc1 = new UrlMembershipCondition ("http://www.go-mono.com");
			SecurityElement se = umc1.ToXml ();

			UrlMembershipCondition umc2 = new UrlMembershipCondition ("*");
			umc2.FromXml (se);

			Assert.AreEqual (umc1.GetHashCode (), umc2.GetHashCode (), "ToFromXmlRoundTrip");
		}
		public void FromXml_NoVersion ()
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
			SecurityElement se = umc.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("class", se.Attribute ("class"));
			umc.FromXml (w);
		}
		public void FromXml_NoClass ()
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
			SecurityElement se = umc.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("version", se.Attribute ("version"));
			umc.FromXml (w);
			// doesn't even care of the class attribute presence
		}
		public void FromXml_InvalidClass ()
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
			SecurityElement se = umc.ToXml ();
			se.Attributes ["class"] = "Hello world";
			umc.FromXml (se);
		}
		public void FromXml_InvalidTag () 
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
			SecurityElement se = umc.ToXml ();
			se.Tag = "IMonoship";
			umc.FromXml (se);
		}
		public void FromXml_Null () 
		{
			UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
			umc.FromXml (null);
		}