public void GetDataUserByUserIdTest() { GetDataUserByUserIdRequest request = new GetDataUserByUserIdRequest(); request.userId = _userGetDataByUserId.UserId; GetDataUserByUserIdResponse response = _userService.GetDataUserByUserId(request); Assert.IsTrue(response.Messages.Count == 0, "Failed get data by Id"); }
public void DeleteDataUser() { GetDataUserByUserIdRequest getRequest = new GetDataUserByUserIdRequest(); getRequest.userId = _userGetDataByUserId.UserId; GetDataUserByUserIdResponse getResponse = _userService.GetDataUserByUserId(getRequest); if (getResponse.Messages.Count != 0 || getResponse.User == null) { throw new Exception("Delete failed!"); } else { DeleteDataUserRequest request = new DeleteDataUserRequest(); request.User = getResponse.User; DeleteDataUserResponse response = _userService.DeleteDataUser(request); } }
public GetDataUserByUserIdResponse GetDataUserByUserId(GetDataUserByUserIdRequest request) { GetDataUserByUserIdResponse response = new GetDataUserByUserIdResponse(); try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted })) { response.User = _userRepo.GetDataByUserId(request.userId); transScope.Complete(); } } catch (Exception ex) { response.Messages.Add(ex.ToString()); } return(response); }