Example #1
0
            public void AD_Get_With_Module_Description_Test()
            {
                string patientId      = "5325dad4d6a4850adcbba776";
                string programId      = "534d9bffd6a48504b058a2cf";
                string userId         = "0000000000000000000000000";
                string desc           = "BSHSI - Outreach & Enrollment";
                string ModuleSourceId = "532b5585a381168abe00042c";

                INGManager ngm = new NGManager {
                    PlanElementUtils = new StubPlanElementUtils(), EndpointUtils = new StubPlanElementEndpointUtils()
                };

                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    Version          = 1.0,
                    ContractNumber   = "InHealth001",
                    PatientId        = patientId,
                    PatientProgramId = programId,
                    UserId           = userId
                };

                GetPatientProgramDetailsSummaryResponse response = ngm.GetPatientProgramDetailsSummary(request);
                Module module = response.Program.Modules.Find(m => m.SourceId == ModuleSourceId);
                string mDesc  = module.Description.Trim();

                Assert.AreEqual(desc, mDesc, true);
            }
Example #2
0
            public void Get_Response_AssignOn_Test()
            {
                string   patientId = "5325dad4d6a4850adcbba776";
                string   programId = "534d9bffd6a48504b058a2cf";
                string   userId    = "0000000000000000000000001";
                DateTime now       = System.DateTime.UtcNow.Date;

                INGManager ngm = new NGManager {
                    PlanElementUtils = new StubPlanElementUtils(), EndpointUtils = new StubPlanElementEndpointUtils()
                };

                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    Version          = 1.0,
                    ContractNumber   = "InHealth001",
                    PatientId        = patientId,
                    PatientProgramId = programId,
                    UserId           = userId
                };

                GetPatientProgramDetailsSummaryResponse response = ngm.GetPatientProgramDetailsSummary(request);
                DateTime assignbyDate = ((DateTime)response.Program.AssignDate).Date;

                Assert.AreEqual(now, assignbyDate);
            }
Example #3
0
            public void Get_AssignById_Test()
            {
                IAuditUtil           audit = new StubAuditUtil();
                INGManager           ngm   = new StubNGManager();
                ISecurityManager     sm    = new StubSecurityManager();
                ICommonFormatterUtil cf    = new StubCommonFormatterUtil();
                string userid = "000000000000000000000000";

                NGService ngs = new NGService
                {
                    AuditUtil           = audit,
                    NGManager           = ngm,
                    Security            = sm,
                    CommonFormatterUtil = cf
                };
                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    ContractNumber = "NG",
                    PatientId      = "",
                    Token          = "dsafgsdfgdafg",
                    UserId         = userid,
                    Version        = 1.0
                };

                GetPatientProgramDetailsSummaryResponse response = ngs.Get(request);
                string result = response.Program.AssignById;

                Assert.AreEqual(userid, result);
            }
Example #4
0
            public void Get_Valid_Response_Test()
            {
                IAuditUtil           audit = new StubAuditUtil();
                INGManager           ngm   = new StubNGManager();
                ISecurityManager     sm    = new StubSecurityManager();
                ICommonFormatterUtil cf    = new StubCommonFormatterUtil();

                NGService ngs = new NGService
                {
                    AuditUtil           = audit,
                    NGManager           = ngm,
                    Security            = sm,
                    CommonFormatterUtil = cf
                };
                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    ContractNumber = "NG",
                    PatientId      = "",
                    Token          = "dsafgsdfgdafg",
                    UserId         = "",
                    Version        = 1.0
                };
                GetPatientProgramDetailsSummaryResponse response = ngs.Get(request);

                Assert.IsNotNull(response);
            }
Example #5
0
            public void AD_Get_With_Module_Description_Test()
            {
                string               desc  = "BSHSI - Outreach & Enrollment";
                IAuditUtil           audit = new StubAuditUtil();
                INGManager           ngm   = new StubNGManager();
                ISecurityManager     sm    = new StubSecurityManager();
                ICommonFormatterUtil cf    = new StubCommonFormatterUtil();

                NGService ngs = new NGService
                {
                    AuditUtil           = audit,
                    NGManager           = ngm,
                    Security            = sm,
                    CommonFormatterUtil = cf
                };
                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    ContractNumber = "NG",
                    PatientId      = "",
                    Token          = "dsafgsdfgdafg",
                    UserId         = "",
                    Version        = 1.0
                };
                GetPatientProgramDetailsSummaryResponse response = ngs.Get(request);

                Module module = response.Program.Modules.Find(m => m.SourceId == "532b5585a381168abe00042c");
                string mDesc  = module.Description.Trim();

                Assert.AreEqual(desc, mDesc, true);
            }
Example #6
0
            public void Get_StateChangeDate_Test()
            {
                IAuditUtil           audit = new StubAuditUtil();
                INGManager           ngm   = new StubNGManager();
                ISecurityManager     sm    = new StubSecurityManager();
                ICommonFormatterUtil cf    = new StubCommonFormatterUtil();
                string   userid            = "000000000000000000000000";
                DateTime now = System.DateTime.UtcNow.Date;

                NGService ngs = new NGService
                {
                    AuditUtil           = audit,
                    NGManager           = ngm,
                    Security            = sm,
                    CommonFormatterUtil = cf
                };
                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    ContractNumber = "NG",
                    PatientId      = "",
                    Token          = "dsafgsdfgdafg",
                    UserId         = userid,
                    Version        = 1.0
                };

                GetPatientProgramDetailsSummaryResponse response = ngs.Get(request);
                DateTime statechangedate = ((DateTime)response.Program.StateUpdatedOn).Date;

                Assert.AreEqual(now, statechangedate);
            }
Example #7
0
            public void With_Attributes_AsNull_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                Assert.IsNull(response.Program.Attributes);
            }
Example #8
0
            public void With_Description_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                Assert.IsNotNull(response.Program.Description);
            }
Example #9
0
            public void Valid_Response_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                Assert.IsNotNull(response);
            }
Example #10
0
            public void GetActionObjectives_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                Assert.IsNotNull(response.Program.Modules[0].Actions[0].Objectives[0]);
            }
Example #11
0
            public void With_EligiblityRequirements_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                Assert.IsNotNull(response.Program.EligibilityRequirements);
                Assert.IsNotNull(response.Program.EligibilityStartDate);
                Assert.IsNotNull(response.Program.EligibilityEndDate);
            }
Example #12
0
            public void Get_Program_StateChangeDate_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                DateTime expected = System.DateTime.UtcNow.Date;
                DateTime?value    = response.Program.StateUpdatedOn;

                Assert.AreEqual(expected, ((DateTime)value).Date);
            }
Example #13
0
            public void GetActionIndividualAttributes_State_Test()
            {
                int actualValue = 4;
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                int expectedValue = response.Program.Modules[0].Actions[0].ElementState;

                Assert.AreEqual(expectedValue, actualValue);
            }
Example #14
0
            public void GetActionIndividualAttributes_AttrEndDate_Test()
            {
                DateTime expectedValue           = DateTime.UtcNow.AddDays(10).Date;
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                DateTime actualValue = (DateTime)response.Program.Modules[0].Actions[0].AttrEndDate;

                Assert.AreEqual(expectedValue, actualValue.Date);
            }
Example #15
0
            public void GetActionObjectives_Value_Test()
            {
                string expectedValue             = "5325da08d6a4850adcbba50e";
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                string actualValue = response.Program.Modules[0].Actions[0].Objectives[0].Id;

                Assert.AreEqual(expectedValue, actualValue);
            }
Example #16
0
            public void GetActionIndividualAttributes_AssignedTo_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                string   expectedValue = response.Program.Modules[0].Actions[0].AssignTo;
                ObjectId objectId;
                bool     success = ObjectId.TryParse(expectedValue, out objectId);

                Assert.IsTrue(success);
            }
Example #17
0
            public void AD_With_Module_Description_Test()
            {
                string desc = "BSHSI - Outreach & Enrollment";
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request  = new GetPatientProgramDetailsSummaryRequest();
                GetProgramDetailsSummaryResponse       response = peu.RequestPatientProgramDetailsSummary(request);

                ModuleDetail module = response.Program.Modules.Find(m => m.SourceId == "532b5585a381168abe00042c");
                string       mDesc  = module.Description.Trim();

                Assert.AreEqual(desc, mDesc, true);
            }
Example #18
0
            public void Get_Program_AssignedBy_Test()
            {
                StubPlanElementEndpointUtils peu = new StubPlanElementEndpointUtils {
                    Client = new StubJsonRestClient()
                };
                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest {
                    UserId = "123456789012345678901234"
                };
                GetProgramDetailsSummaryResponse response = peu.RequestPatientProgramDetailsSummary(request);

                string   expectedValue = response.Program.AssignBy;
                ObjectId objectId;
                bool     success = ObjectId.TryParse(expectedValue, out objectId);

                Assert.IsTrue(success);
            }
Example #19
0
            public void Get_With_Attributes_Test()
            {
                string patientId = "5325dab8d6a4850adcbba71a";
                string programId = "534d9217d6a48504b0586f68";
                string userId    = "0000000000000000000000000";

                INGManager ngm = new NGManager {
                    PlanElementUtils = new StubPlanElementUtils(), EndpointUtils = new StubPlanElementEndpointUtils()
                };

                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    Version          = 1.0,
                    ContractNumber   = "InHealth001",
                    PatientId        = patientId,
                    PatientProgramId = programId,
                    UserId           = userId
                };

                GetPatientProgramDetailsSummaryResponse response = ngm.GetPatientProgramDetailsSummary(request);

                Assert.IsNotNull(response.Program.Attributes);
            }
Example #20
0
            public void Get_With_No_Steps_Test()
            {
                string patientId = "5325dab8d6a4850adcbba71a";
                string programId = "534d9217d6a48504b0586f68";
                string userId    = "0000000000000000000000000";

                INGManager ngm = new NGManager {
                    PlanElementUtils = new StubPlanElementUtils(), EndpointUtils = new StubPlanElementEndpointUtils()
                };

                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    Version          = 1.0,
                    ContractNumber   = "InHealth001",
                    PatientId        = patientId,
                    PatientProgramId = programId,
                    UserId           = userId
                };

                GetPatientProgramDetailsSummaryResponse response = ngm.GetPatientProgramDetailsSummary(request);

                Assert.AreEqual(0, response.Program.Modules[0].Actions[0].Steps.Count);
            }
Example #21
0
            public void Get_With_Description_Test()
            {
                string patientId = "5325dad4d6a4850adcbba776";
                string programId = "534d9bffd6a48504b058a2cf";
                string userId    = "0000000000000000000000000";

                INGManager ngm = new NGManager {
                    PlanElementUtils = new StubPlanElementUtils(), EndpointUtils = new StubPlanElementEndpointUtils()
                };

                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    Version          = 1.0,
                    ContractNumber   = "InHealth001",
                    PatientId        = patientId,
                    PatientProgramId = programId,
                    UserId           = userId
                };

                GetPatientProgramDetailsSummaryResponse response = ngm.GetPatientProgramDetailsSummary(request);

                Assert.IsNotNull(response.Program.Description);
            }
Example #22
0
            public void Get_Response_AssignById_Test()
            {
                string patientId = "5325dad4d6a4850adcbba776";
                string programId = "534d9bffd6a48504b058a2cf";
                string userId    = "0000000000000000000000000";

                INGManager ngm = new NGManager {
                    PlanElementUtils = new StubPlanElementUtils(), EndpointUtils = new StubPlanElementEndpointUtils()
                };

                GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest
                {
                    Version          = 1.0,
                    ContractNumber   = "InHealth001",
                    PatientId        = patientId,
                    PatientProgramId = programId,
                    UserId           = userId
                };

                GetPatientProgramDetailsSummaryResponse response = ngm.GetPatientProgramDetailsSummary(request);
                string assignbyid = response.Program.AssignById;

                Assert.AreEqual(userId, assignbyid);
            }
Example #23
0
        public void GetPatientProgramDetailsSummary_Test()
        {
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            double      version        = 1.0;
            string      token          = "53693860d6a485044ccb0f0b";
            IRestClient client         = new JsonServiceClient();

            GetPatientProgramDetailsSummaryRequest request = new GetPatientProgramDetailsSummaryRequest {
                PatientId = "5325d9f2d6a4850adcbba4ca", UserId = "000000000000000000000000"
            };

            JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("Token: {0}", token));
            // [Route("/{Version}/{ContractNumber}/Patient/{PatientId}/Program/{PatientProgramId}/", "GET")]
            GetPatientProgramDetailsSummaryResponse response = client.Get <GetPatientProgramDetailsSummaryResponse>(
                string.Format(@"http://localhost:888/Nightingale/{0}/{1}/Patient/{2}/Program/{3}?Context={4}",
                              version,
                              contractNumber,
                              request.PatientId,
                              request.PatientProgramId,
                              context));

            Assert.IsNotNull(response.Program.Modules[0].Objectives);
        }
Example #24
0
 public GetProgramDetailsSummaryResponse RequestPatientProgramDetailsSummary(GetPatientProgramDetailsSummaryRequest request)
 {
     throw new NotImplementedException();
 }
Example #25
0
        public DD.GetProgramDetailsSummaryResponse RequestPatientProgramDetailsSummary(GetPatientProgramDetailsSummaryRequest request)
        {
            try
            {
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Program/{5}/Details",
                                                                          DDProgramServiceUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber,
                                                                          request.PatientId,
                                                                          request.PatientProgramId), request.UserId);

                DD.GetProgramDetailsSummaryResponse resp =
                    client.Get <DD.GetProgramDetailsSummaryResponse>(url);
                return(resp);
            }
            catch (Exception ex)
            {
                throw new Exception("AD:PlanElementEndpointUtil:RequestPatientProgramDetailsSummary()::" + ex.Message, ex.InnerException);
            }
        }