public void Get_Action_With_AssignTo_Id() { ObjectId guid = ObjectId.GenerateNewId(); List <Actions> list = new List <Actions> { new Actions { AssignToId = guid.ToString() } }; var nList = NGUtils.GetADActions(list); Assert.AreEqual(guid.ToString(), ((ActionsDetail)nList[0]).AssignTo); }
public void Get_With_AssignTo_Id() { ObjectId guid = ObjectId.GenerateNewId(); List <Module> list = new List <Module> { new Module { AssignToId = guid.ToString() } }; var nList = NGUtils.GetADModules(list); Assert.AreEqual(guid.ToString(), ((ModuleDetail)nList[0]).AssignTo); }
public void GetMedStrengthAndUnit_When_Both_Strength_And_Unit_AreNot_Present_Success() { //Arrange string strength = string.Empty; string unit = string.Empty; string strengthAndUnit = string.Empty; //Act NGUtils.GetMedStrengthAndUnit(strengthAndUnit, out strength, out unit); //Assert Assert.IsTrue(strength.IsEmpty() && unit.IsEmpty()); }
public void GetMedStrengthAndUnit_When_Both_Strength_And_Unit_Are_Present_Success() { //Arrange string strength = string.Empty; string unit = string.Empty; string strengthAndUnit = "6 [hp_C]/33.3mL; 6 [hp_C]/33.3mL; 6 [hp_X]/33.3mL; 6 [hp_X]/33.3mL; 6 [hp_X]/33.3mL"; //Act NGUtils.GetMedStrengthAndUnit(strengthAndUnit, out strength, out unit); //Assert Assert.IsTrue(strength == "6; 6; 6; 6; 6" && unit == "[hp_C]/33.3mL; [hp_C]/33.3mL; [hp_X]/33.3mL; [hp_X]/33.3mL; [hp_X]/33.3mL"); }
public void NGUtil_SetContactPreferredName_NotEmptyPreferredName_Should_Set_PreferredName_To_PreferredName_WhenLastNameEmpty() { //Arrange var contact = new DTO.Contact { Id = "cid", FirstName = "System", LastName = "", PreferredName = "System" }; //Act NGUtils.SetContactPreferredName(contact); //Assert Assert.IsTrue("System" == contact.PreferredName); }
public void NGUtil_SetContactPreferredName_NotEmptyPreferredName_Should_Set_PreferredName_To_PreferredNamePlusLastName() { //Arrange var contact = new DTO.Contact { Id = "cid", FirstName = "firstname", LastName = "lastname", PreferredName = "preferredname" }; var preferrednamelastname = contact.PreferredName + " " + contact.LastName; //Act NGUtils.SetContactPreferredName(contact); //Assert Assert.IsTrue(preferrednamelastname == contact.PreferredName); }
public List <string> GetMedicationNDCs(PostPatientMedSuppRequest request) { try { List <string> result = null; IRestClient client = new JsonServiceClient(); //[Route("/{Context}/{Version}/{ContractNumber}/Medication/Search", "GET")] var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Medication/Search", DDMedicationUrl, "NG", request.Version, request.ContractNumber), request.UserId); string strength = null; string unit = null; NGUtils.GetMedStrengthAndUnit(request.PatientMedSupp.Strength, out strength, out unit); GetMedicationNDCsDataResponse dataDomainResponse = client.Post <GetMedicationNDCsDataResponse>(url, new GetMedicationNDCsDataRequest { Context = "NG", ContractNumber = request.ContractNumber, UserId = request.UserId, Version = request.Version, Name = request.PatientMedSupp.Name, Strength = strength, Unit = unit, Form = request.PatientMedSupp.Form, Route = request.PatientMedSupp.Route } as object); if (dataDomainResponse != null) { result = dataDomainResponse.NDCcodes; } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:GetMedicationDetails()::" + ex.Message, ex.InnerException); } }
public static void Build() { Mapper.CreateMap <GoalData, Goal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <TaskData, Task>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <Task, PatientTask>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <PatientTaskData, PatientTask>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <InterventionData, Intervention>(); // goal to patientgoal Mapper.CreateMap <Goal, PatientGoal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <PatientInterventionData, PatientIntervention>(); Mapper.CreateMap <PatientGoalData, PatientGoal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))) .ForMember(d => d.Barriers, opt => opt.MapFrom(src => src.BarriersData.ConvertAll( c => new PatientBarrier { Id = c.Id, CategoryId = c.CategoryId, DeleteFlag = c.DeleteFlag, Name = c.Name, PatientGoalId = c.PatientGoalId, StatusDate = c.StatusDate, StatusId = c.StatusId, Details = c.Details }))) .ForMember(d => d.Tasks, opt => opt.MapFrom(src => src.TasksData.ConvertAll( c => new PatientTask { Id = c.Id, BarrierIds = c.BarrierIds, ClosedDate = c.ClosedDate, CreatedById = c.CreatedById, CustomAttributes = c.CustomAttributes.ConvertAll( ca => new CustomAttribute { ControlType = ca.ControlType, Id = ca.Id, Name = ca.Name, Order = ca.Order, Required = ca.Required, Type = ca.Type, Values = ca.Values, Options = NGUtils.FormatOptions(ca.Options) }), DeleteFlag = c.DeleteFlag, Description = c.Description, GoalName = c.GoalName, PatientGoalId = c.PatientGoalId, StartDate = c.StartDate, StatusDate = c.StatusDate, StatusId = c.StatusId, TargetDate = c.TargetDate, TargetValue = c.TargetValue, Details = c.Details }))) .ForMember(d => d.Interventions, opt => opt.MapFrom(src => src.InterventionsData.ConvertAll( c => new PatientIntervention { AssignedToId = c.AssignedToId, BarrierIds = c.BarrierIds, CategoryId = c.CategoryId, ClosedDate = c.ClosedDate, CreatedById = c.CreatedById, DeleteFlag = c.DeleteFlag, Description = c.Description, GoalName = c.GoalName, Id = c.Id, PatientGoalId = c.PatientGoalId, PatientId = c.PatientId, StartDate = c.StartDate, DueDate = c.DueDate, StatusDate = c.StatusDate, StatusId = c.StatusId, Details = c.Details }))); }
public void Process_Action_With_Task_Spawn_by_step() { IPlanManager pm = new PlanManager { PEUtils = new StubPlanElementUtils(), EndPointUtils = new StubPlanElementEndpointUtils(), StepProcessor = new StubStepPlanProcessor() { ElementActivationStrategy = new StubElementActivationStrategy(), PEUtils = new StubPlanElementUtils() } }; //mappers Mapper.CreateMap <Task, PatientTask>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <PatientTaskData, PatientTask>().ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <PatientTask, PatientTaskData>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <TaskData, Task>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <GoalData, Goal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <Goal, PatientGoal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); Mapper.CreateMap <PatientGoalData, PatientGoal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))) .ForMember(d => d.Barriers, opt => opt.MapFrom(src => src.BarriersData.ConvertAll( c => new PatientBarrier { Id = c.Id, CategoryId = c.CategoryId, DeleteFlag = c.DeleteFlag, Name = c.Name, PatientGoalId = c.PatientGoalId, StatusDate = c.StatusDate, StatusId = c.StatusId, Details = c.Details }))) .ForMember(d => d.Tasks, opt => opt.MapFrom(src => src.TasksData.ConvertAll( c => new PatientTask { Id = c.Id, BarrierIds = c.BarrierIds, ClosedDate = c.ClosedDate, CreatedById = c.CreatedById, CustomAttributes = c.CustomAttributes.ConvertAll( ca => new CustomAttribute { ControlType = ca.ControlType, Id = ca.Id, Name = ca.Name, Order = ca.Order, Required = ca.Required, Type = ca.Type, Values = ca.Values, Options = NGUtils.FormatOptions(ca.Options) }), DeleteFlag = c.DeleteFlag, Description = c.Description, GoalName = c.GoalName, PatientGoalId = c.PatientGoalId, StartDate = c.StartDate, StatusDate = c.StatusDate, StatusId = c.StatusId, TargetDate = c.TargetDate, TargetValue = c.TargetValue, Details = c.Details }))) .ForMember(d => d.Interventions, opt => opt.MapFrom(src => src.InterventionsData.ConvertAll( c => new PatientIntervention { AssignedToId = c.AssignedToId, BarrierIds = c.BarrierIds, CategoryId = c.CategoryId, ClosedDate = c.ClosedDate, CreatedById = c.CreatedById, DeleteFlag = c.DeleteFlag, Description = c.Description, GoalName = c.GoalName, Id = c.Id, PatientGoalId = c.PatientGoalId, PatientId = c.PatientId, StartDate = c.StartDate, DueDate = c.DueDate, StatusDate = c.StatusDate, StatusId = c.StatusId, Details = c.Details }))); ObjectId actionId = ObjectId.Parse("538ca77dfe7a59112c3649e4"); PostProcessActionRequest request = new PostProcessActionRequest { ContractNumber = "InHealth001", PatientId = "123456789012345678901234", ProgramId = "000000000000000000000000", UserId = "111111111111111111111111", Version = 1.0, Action = new DTO.Actions { Id = actionId.ToString(), Completed = true, ElementState = 4, Name = "test action from stub", Description = "action Description", Text = "test action 1", AttrEndDate = DateTime.UtcNow.AddDays(10), AttrStartDate = DateTime.UtcNow, AssignDate = System.DateTime.UtcNow, Steps = new List <Step> { new Step { Id = "000000000011111111111234", Completed = true, ElementState = 1, SpawnElement = new List <SpawnElement> { new SpawnElement { ElementId = "5463cd99fe7a592668f67a15", ElementType = 501, Tag = "" } } } } } }; PostProcessActionResponse response = pm.ProcessActionResults(request); Assert.IsNotNull(response.PlanElems); Assert.IsNotNull(response.PlanElems.Actions); Assert.IsNotNull(response.PlanElems.Interventions); }
public void GetPatientGoalByTemplateId_Null() { #region Mapper.CreateMap <PatientGoalData, PatientGoal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))) .ForMember(d => d.Barriers, opt => opt.MapFrom(src => src.BarriersData.ConvertAll( c => new PatientBarrier { Id = c.Id, CategoryId = c.CategoryId, DeleteFlag = c.DeleteFlag, Name = c.Name, PatientGoalId = c.PatientGoalId, StatusDate = c.StatusDate, StatusId = c.StatusId, Details = c.Details }))) .ForMember(d => d.Tasks, opt => opt.MapFrom(src => src.TasksData.ConvertAll( c => new PatientTask { Id = c.Id, BarrierIds = c.BarrierIds, ClosedDate = c.ClosedDate, CreatedById = c.CreatedById, CustomAttributes = c.CustomAttributes.ConvertAll( ca => new CustomAttribute { ControlType = ca.ControlType, Id = ca.Id, Name = ca.Name, Order = ca.Order, Required = ca.Required, Type = ca.Type, Values = ca.Values, Options = NGUtils.FormatOptions(ca.Options) }), DeleteFlag = c.DeleteFlag, Description = c.Description, GoalName = c.GoalName, PatientGoalId = c.PatientGoalId, StartDate = c.StartDate, StatusDate = c.StatusDate, StatusId = c.StatusId, TargetDate = c.TargetDate, TargetValue = c.TargetValue, Details = c.Details }))) .ForMember(d => d.Interventions, opt => opt.MapFrom(src => src.InterventionsData.ConvertAll( c => new PatientIntervention { AssignedToId = c.AssignedToId, BarrierIds = c.BarrierIds, CategoryId = c.CategoryId, ClosedDate = c.ClosedDate, CreatedById = c.CreatedById, DeleteFlag = c.DeleteFlag, Description = c.Description, GoalName = c.GoalName, Id = c.Id, PatientGoalId = c.PatientGoalId, PatientId = c.PatientId, StartDate = c.StartDate, DueDate = c.DueDate, StatusDate = c.StatusDate, StatusId = c.StatusId, Details = c.Details }))); #endregion EndpointUtils utils = new EndpointUtils(); var patientGoal = utils.GetOpenNotMetPatientGoalByTemplateId("123491a1fe7a59218cef2d6d", "5325db9cd6a4850adcbba9ca", "1234", new AppDomainRequest { Version = 1.0, ContractNumber = "InHealth001", UserId = "1234" }); Assert.IsNull(patientGoal); }
public void NGUtil_SetContactPreferredName_NullContactCard_Should_Throw() { NGUtils.SetContactPreferredName(null); }