ToXml() public method

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

			SiteMembershipCondition smc2 = new SiteMembershipCondition ("*");
			smc2.FromXml (se);

			Assert.AreEqual (smc1.GetHashCode (), smc2.GetHashCode (), "ToFromXmlRoundTrip");
		}
		public void FromXml_NoVersion ()
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			SecurityElement se = smc.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("class", se.Attribute ("class"));
			smc.FromXml (w);
		}
		public void ToXml_Null () 
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			// no ArgumentNullException here
			SecurityElement se = smc.ToXml (null);
			Assert.IsNotNull (se, "ToXml(null)");
		}
		public void FromXml_InvalidVersion ()
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			SecurityElement se = smc.ToXml ();
			se.Attributes ["version"] = "2";
			smc.FromXml (se);
		}
		public void FromXml_NoClass ()
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			SecurityElement se = smc.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("version", se.Attribute ("version"));
			smc.FromXml (w);
			// doesn't even care of the class attribute presence
		}
		public void FromXml_InvalidClass ()
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			SecurityElement se = smc.ToXml ();
			se.Attributes ["class"] = "Hello world";
			smc.FromXml (se);
		}
		public void FromXml_InvalidTag () 
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			SecurityElement se = smc.ToXml ();
			se.Tag = "IMonoship";
			smc.FromXml (se);
		}
 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);
 }