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 ToString_ () { HashMembershipCondition hash = new HashMembershipCondition (md5, digestMd5); Assert.IsTrue (hash.ToString ().StartsWith ("Hash - System.Security.Cryptography.MD5"), "MD5"); hash = new HashMembershipCondition (sha1, digestSha1); Assert.IsTrue (hash.ToString ().StartsWith ("Hash - System.Security.Cryptography.SHA1"), "SHA1"); }
public void FromXml_Empty_ToString () { HashMembershipCondition hash = new HashMembershipCondition (md5, digestMd5); SecurityElement se = hash.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("class", se.Attribute ("class")); w.AddAttribute ("version", "1"); hash.FromXml (w); // this is accepted - but doesn't include a hash algorithm or value // both would throw ArgumentNullException from the constructor string s = hash.ToString (); }