public void TestHashCode() { var item = new User {UserName = "******", Password = "******"}; var item2 = new User {UserName = "******", Password = "******"}; Assert.Equal(item.GetHashCode(), item2.GetHashCode()); }
public void TestEqualWithSelfAndWithNull() { var item = new User { UserName = "******", Password = "******" }; var item2 = new User {UserName = "******", Password = "******"}; Assert.True(item.Equals(item)); Assert.False(item.Equals(null)); Assert.True(item.Equals(item2)); }
public void TestEqualWithObject() { var item = new User { UserName = "******", Password = "******" }; var item2 = new User { UserName = "******", Password = "******" }; var itemGroup = new ItemGroup(); Assert.False(item.Equals((object)null)); Assert.True(item.Equals((object)item)); Assert.False(item.Equals((object)itemGroup)); Assert.True(item.Equals(item2)); }
public void IsValidIfUserNameOrPassEmptyReturnsFalse() { IUserService userService = new UserService(); var user = new User { Password = "******" }; Assert.False(userService.IsValid(user)); user.UserName = "******"; user.Password = string.Empty; Assert.False(userService.IsValid(user)); }
public void CreationUserWithoutNameAndPassFiredException() { PrepareRepository(); var user = new User { Password = "******", Email = "*****@*****.**" }; Assert.Throws<ArgumentException>(() => _repository.SaveOnCommit(user)); user.UserName = "******"; user.Password = null; Assert.Throws<ArgumentException>(() => _repository.SaveOnCommit(user)); }
public void TestUserCreationAdnDeleting() { PrepareRepository(); var user = new User { UserName = "******", Password = "******", Email = "*****@*****.**" }; var result = _repository.SaveOnCommit(user); Assert.True(result); _unitOfWork.Commit(); result = _repository.DeleteOnCommit(user); Assert.True(result); _unitOfWork.Commit(); }
public void UpdatingUnexistableItemIsImmposible() { PrepareRepository(); var user = new User{ID = 300}; var result = _repository.SaveOnCommit(user); Assert.False(result); }
public void UpdatingUserTests() { PrepareRepository(); var user = new User{UserName = "******", Password = "******", Email = "asd"}; var result = _repository.SaveOnCommit(user); Assert.True(result); _unitOfWork.Commit(); var oldUser = UserService.GetByName(user.UserName); Assert.True(oldUser.ID != 0 && oldUser.ID != -1); oldUser.Password = "******"; result = _repository.SaveOnCommit(oldUser); Assert.True(result); _unitOfWork.Commit(); result = _repository.DeleteOnCommit(oldUser); Assert.True(result); _unitOfWork.Commit(); }
public bool Equals(User other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.UserName, UserName) && Equals(other.Password, Password); }