public void AuthUserWrongPassword() { var testAttempt = new UserAuth { Username = "******", Password = "******" }; var returnUser = new User { Username = "******", Email = "gico223", AccessLevel = 10, Name = "emailTeste", Password = "******", Salt = "RUb4A4w5VyR1GuIkttKmyA==" }; var config = TestHelper.InitConfiguration(); var userRepository = new Mock <IUserRepository>(); userRepository.Setup(p => p.GetUserByUsername(testAttempt.Username)).Returns(Task.FromResult(returnUser)); var userBusiness = new UserBusiness(userRepository.Object, config); var token = userBusiness.AuthUser(testAttempt.Username, testAttempt.Password).Result; Assert.Equal("Erro: Usuario ou senha não encontrado.", token); }
public void AuthUserNoUsername() { var testAttempt = new UserAuth { Username = "******", Password = "******" }; User returnUser = null; var config = TestHelper.InitConfiguration(); var userRepository = new Mock <IUserRepository>(); userRepository.Setup(p => p.GetUserByUsername(testAttempt.Username)).Returns(Task.FromResult(returnUser)); var userBusiness = new UserBusiness(userRepository.Object, config); var token = userBusiness.AuthUser(testAttempt.Username, testAttempt.Password).Result; Assert.Equal("Erro: Usuario ou senha não encontrado.", token); }