public void TestEquality() { using (PasswordHash pwd1 = new PasswordHash(TEST_PASSWORD)) using (PasswordHash pwd2 = new PasswordHash(TEST_PASSWORD, pwd1.Salt)) { Assert.AreEqual(pwd1, pwd2); Assert.AreEqual(pwd1.Salt.ToArray(), pwd2.Salt.ToArray()); Assert.AreEqual(pwd1.ToArray(), pwd2.ToArray()); Assert.IsTrue(pwd1 == pwd2); Assert.IsTrue(pwd1 == pwd2); Assert.IsFalse(pwd1 != pwd2); Assert.IsTrue(pwd1.Equals(pwd2)); Assert.IsTrue(pwd1.Equals((object)pwd2)); Assert.AreEqual(0, pwd1.CompareTo(pwd2)); Assert.AreEqual(pwd1.GetHashCode(), pwd2.GetHashCode()); Assert.AreEqual(pwd1.ToString(), pwd2.ToString()); PasswordHash nil = null; Assert.IsFalse(pwd1 < nil); Assert.IsTrue(pwd1 > nil); Assert.AreEqual(1, pwd1.CompareTo(null)); } }