Equals() public method

public Equals ( object o ) : bool
o object
return bool
		public void SiteMembershipCondition_GoMonoWebSite () 
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("www.go-mono.com");
			Assert.AreEqual ("www.go-mono.com", smc.Site, "Site");
			Assert.AreEqual ("Site - www.go-mono.com", smc.ToString (), "ToString");

			SiteMembershipCondition smc2 = (SiteMembershipCondition) smc.Copy ();
			Assert.AreEqual (smc.Site, smc2.Site, "Copy.Site");
			Assert.AreEqual (smc.GetHashCode (), smc2.GetHashCode (), "Copy.GetHashCode");

			SecurityElement se = smc2.ToXml ();
			SiteMembershipCondition smc3 = new SiteMembershipCondition ("*");
			smc3.FromXml (se);
			Assert.AreEqual (smc.Site, smc3.Site, "ToXml/FromXml");

			Assert.IsTrue (smc.Equals (smc2), "Equals");
			SiteMembershipCondition smc4 = new SiteMembershipCondition ("go-mono.com");
			Assert.IsFalse (smc.Equals (smc4), "!Equals");
		}
		public void Equals () 
		{
			SiteMembershipCondition smc1 = new SiteMembershipCondition ("*.go-mono.com");
			Assert.IsFalse (smc1.Equals (null), "Null");
			SiteMembershipCondition smc2 = new SiteMembershipCondition ("*.Go-Mono.com");
			Assert.IsTrue (smc1.Equals (smc2), "CaseSensitive");
		}
		public void FromXml_PolicyLevel () 
		{
			SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
			SecurityElement se = smc.ToXml ();
			// 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.IsTrue (spl.Equals (smc), "FromXml(PolicyLevel='" + pl.Label + "')");
			}
			// yes!
		}
Ejemplo n.º 4
0
 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);
 }