public void TestEquality() { Salt s = new Salt(); Salt scopy = Salt.FromBytes(s.ToArray()); Assert.AreEqual(s, scopy); Assert.IsTrue(s.Equals(scopy)); Assert.IsTrue(s.Equals((object)scopy)); Assert.IsTrue(s == scopy); Assert.IsFalse(s != scopy); Assert.AreEqual(s.GetHashCode(), scopy.GetHashCode()); scopy = new Salt(); Assert.AreNotEqual(s, scopy); Assert.IsFalse(s.Equals(scopy)); Assert.IsFalse(s.Equals((object)scopy)); Assert.IsFalse(s == scopy); Assert.IsTrue(s != scopy); Assert.AreNotEqual(s.GetHashCode(), scopy.GetHashCode()); }
public override bool Equals(object obj) { if (!(obj is UserDto entity)) { return(false); } if (Id == entity.Id && UserName.Equals(entity.UserName, StringComparison.Ordinal) && PasswordHash.Equals(entity.PasswordHash, StringComparison.Ordinal) && Salt.Equals(entity.Salt, StringComparison.Ordinal) && Email.Equals(entity.Email, StringComparison.Ordinal) && Firstname.Equals(entity.Firstname, StringComparison.OrdinalIgnoreCase) && Surname.Equals(entity.Surname, StringComparison.OrdinalIgnoreCase) && Culture.Equals(entity.Culture, StringComparison.OrdinalIgnoreCase) && Timezone.Equals(entity.Timezone, StringComparison.OrdinalIgnoreCase) && Amount == entity.Amount) { return(true); } return(false); }