public GetProblemDataResponse GetProblem(GetProblemDataRequest request) { GetProblemDataResponse response = new GetProblemDataResponse(); ILookUpRepository repo = Factory.GetRepository(request, RepositoryType.LookUp); response.Problem = repo.FindProblemByID(request.ProblemID) as ProblemData; return(response); }
public void GetProblemByID_Test() { // Arrange double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; GetProblemDataRequest request = new GetProblemDataRequest { ProblemID = "528a6709d4332317acc50962", Context = context, ContractNumber = contractNumber, Version = version }; LookUpDataManager lm = new LookUpDataManager { Factory = new LookUpRepositoryFactory() }; // Act GetProblemDataResponse response = lm.GetProblem(request); // Assert Assert.IsTrue(response.Problem.Name == "CKD"); }
public GetProblemDataResponse Get(GetProblemDataRequest request) { GetProblemDataResponse response = new GetProblemDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("LookUpDD:Get()::Unauthorized Access"); } response = LookUpDataManager.GetProblem(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Common.Helper.LogException(int.Parse(aseProcessID), ex); } return(response); }
public void GetProblemByID_Test() { // Arrange string expectedValue = "Arthritis"; double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; string problemID = "528a66fdd4332317acc50960"; IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df")); // Act GetProblemDataResponse response = client.Get <GetProblemDataResponse> (string.Format("{0}/{1}/{2}/{3}/problem/{4}", "http://localhost:8888/LookUp/", context, version, contractNumber, problemID)); string actualValue = response.Problem.Name; // Assert Assert.AreEqual(expectedValue, actualValue, true); }