public void MustReturnTrueIfUserExists()
        {
            var allUsers = _readUserProfileRepository.GetAllUsers();

            if (allUsers.Any())
            {
                var user = allUsers.First();

                Assert.IsTrue(_userProfileDomainService.IsAlreadyExist(user.LoginData.Login));
            }
        }
        public async Task CanNotCreateIfUserAlreadyExists()
        {
            var allUsers = _readUserProfileRepository.GetAllUsers();

            if (allUsers.Any())
            {
                var existingUser = allUsers.First();
                _defaultNewProfile.Login = existingUser.LoginData.Login;
                bool createdSuccessfully = await Mediator.Send(new RegisterNewProfileCommand(_defaultNewProfile));

                Assert.IsFalse(createdSuccessfully);
            }
        }
        public bool IsAlreadyExist(string login)
        {
            login.NotNullOrEmpty();

            return(_readUserProfileRepository.GetAllUsers().Any(user => user.LoginData.Login == login));
        }
Beispiel #4
0
 public void GetUsers_NotFails()
 {
     _readUsersRepository.GetAllUsers();
 }