public void CreateUser() { var user = new User(1, "admin", true); Assert.AreEqual(1, user.Id); Assert.AreEqual("admin", user.Username); Assert.AreEqual(true, user.Online); }
public void Equals() { var user1 = new User(1, "admin", true); var user2 = new User(1, "admin", true); Assert.IsTrue(user1.Equals(user2)); // ReSharper disable once EqualExpressionComparison Assert.IsTrue(user1.Equals(user1)); Assert.IsFalse(user1.Equals(null)); // ReSharper disable once SuspiciousTypeConversion.Global Assert.IsFalse(user1.Equals(new double())); }
protected bool Equals(User other) { return string.Equals(Username, other.Username) && Online.Equals(other.Online) && Id == other.Id; }
public void _GetHashCode() { var user1 = new User(1, "admin", true); Assert.AreEqual(-2020886245, user1.GetHashCode()); }