Equals() public method

public Equals ( object o ) : bool
o object
return bool
示例#1
0
 public static void HashMembershipConditionCallMethods()
 {
     HashMembershipCondition hmc = new HashMembershipCondition(Cryptography.SHA1.Create(), new byte[1]);
     bool check = hmc.Check(new Evidence());
     IMembershipCondition obj = hmc.Copy();
     check = hmc.Equals(new object());
     int hash = hmc.GetHashCode();
     string str = hmc.ToString();
     SecurityElement se = new SecurityElement("");
     PolicyLevel pl = (PolicyLevel)Activator.CreateInstance(typeof(PolicyLevel), true);
     hmc.FromXml(se);
     hmc.FromXml(se, pl);
     se = hmc.ToXml();
     se = hmc.ToXml(pl);
 }
		public void Equals ()
		{
			HashMembershipCondition hash = new HashMembershipCondition (md5, digestMd5);
			Assert.IsFalse (hash.Equals (null), "Equals(null)");
			Assert.IsFalse (hash.Equals (new object ()), "Equals (object)");

			HashMembershipCondition h2 = new HashMembershipCondition (md5, digestMd5);
			Assert.IsTrue (hash.Equals (h2), "Equals(h2)");
			Assert.IsTrue (h2.Equals (hash), "Equals(hash)");

			// same assembly but different algorithm / value
			hash = new HashMembershipCondition (sha1, digestSha1);
			Assert.IsFalse (hash.Equals (h2), "Equals(h2)");
			Assert.IsFalse (h2.Equals (hash), "Equals(hash)");
		}