public GetCareTeamDataResponse Get(GetCareTeamDataRequest request) { var response = new GetCareTeamDataResponse() { Version = request.Version }; try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ContactDD:CareTeamService:Get()::Unauthorized Access"); } response = Manager.GetCareTeam(request); } catch (Exception ex) { CommonFormat.FormatExceptionResponse(response, base.Response, ex); var aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }
public void CareTeamDataManager_GetCareTeam_Null_Repository_Should_Throw() { var mockFactory = new Mock <ICareTeamRepositoryFactory>(); var stubRequest = new GetCareTeamDataRequest { ContactId = "12345" }; mockFactory.Setup( f => f.GetCareTeamRepository(It.IsAny <IDataDomainRequest>(), It.IsAny <RepositoryType>())) .Returns((ICareTeamRepository)null); var manager = new CareTeamDataManager(mockFactory.Object); var data = manager.GetCareTeam(stubRequest); }
public GetCareTeamDataResponse GetCareTeam(GetCareTeamDataRequest request) { var response = new GetCareTeamDataResponse(); if (request == null) { throw new ArgumentNullException("request"); } if (string.IsNullOrEmpty(request.ContactId)) { throw new ArgumentNullException("ContactId"); } var repo = _factory.GetCareTeamRepository(request, RepositoryType.CareTeam); if (repo == null) { throw new Exception("Repository is null"); } response.CareTeamData = (CareTeamData)repo.GetCareTeamByContactId(request.ContactId); return(response); }