Example #1
0
 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);
 }
Example #2
0
        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()));
        }
Example #3
0
 protected bool Equals(User other)
 {
     return string.Equals(Username, other.Username) && Online.Equals(other.Online) && Id == other.Id;
 }
Example #4
0
 public void _GetHashCode()
 {
     var user1 = new User(1, "admin", true);
     Assert.AreEqual(-2020886245, user1.GetHashCode());
 }