예제 #1
0
 private bool CheckUser(LogInData currUser, string password)
 {
     if (currUser.PasswordHash == this.CreateHashPassword(password, currUser.PasswordSalt))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 private AccountService Initialize(LogInData testLogin, User testUser)
 {
     var logger = new Mock<ILogger>();
     var iUserRepository = new Mock<IRepository<User>>();
     var iLogRepository = new Mock<IRepository<LogInData>>();
     var iUnitOfWork = new Mock<IUnitOfWork>();
     iUnitOfWork.Setup(st => st.LogInDataRepository).Returns(iLogRepository.Object);
     iUnitOfWork.Setup(st => st.UserRepository).Returns(iUserRepository.Object);
     iLogRepository.Setup(i => i.Get(It.IsAny<Expression<Func<LogInData, bool>>>())).Returns(testLogin);
     iUserRepository.Setup(i => i.GetById(It.Is<int>(y => y == testLogin.UserId))).Returns(testUser);
     return new AccountService(logger.Object, iUnitOfWork.Object);
 }