public void ErrorAuthenticateUserEmailOrPasswordInvalid() { Servico.Entities.Customer customer = null; _userRepo.Setup((s) => s.Authenticate(It.IsAny <Servico.Entities.User>())).Returns(Task.FromResult(customer)); var command = new AuthenticateUserCommand("[email protected]", "abc123", _appSettings); var commandResult = new UserCommandHandler(_mapper, _userRepo.Object) .Handle(command, new CancellationToken()).Result; Assert.True(commandResult.HasError(2004)); }
public void ErrorUpdateCustomerIdUserNotExists() { _customerRepo.Setup(s => s.IdCustomerExists(It.IsAny <int>())).Returns(Task.FromResult(true)); var customer = new Servico.Entities.Customer(1, 1, "MY NAME", "MY ADDRESS"); _customerRepo.Setup(s => s.GetCustomer(It.IsAny <int>())).Returns(Task.FromResult(customer)); _userRepo.Setup((s) => s.IdUserExists(It.IsAny <int>())).Returns(Task.FromResult(false)); var command = new UpdateCustomerCommand(1, "Cassio Guilhermy", "[email protected]", "cass123", "Gyn", true, _appSettings); var commandResult = new CustomerCommandHandler(_mapper, _customerRepo.Object, _userRepo.Object) .Handle(command, new CancellationToken()).Result; Assert.True(commandResult.HasError(2000)); }