Пример #1
0
            public void PatientToDoExistsTest_false()
            {
                var todoRule = new ToDoActivationRule
                {
                    EndpointUtil = new EndpointUtils(),
                    PlanUtils    = new StubPlanElementUtils()
                };

                const string patientId = "5325da35d6a4850adcbba58e";
                const string userId    = "1234";
                const string elemId    = "53ff6b92d4332314bcab46e0";

                var eventArg = new PlanElementEventArg
                {
                    Action        = new Actions(),
                    DomainRequest =
                        new AppDomainRequest {
                        Version = 1.0, ContractNumber = "InHealth001", UserId = "1234"
                    },
                    PatientId   = patientId,
                    UserId      = userId,
                    PlanElement = new PlanElement {
                        Id = ""
                    }
                };

                var result = todoRule.PatientToDoExists(eventArg, elemId);

                Assert.IsFalse(result);
            }
Пример #2
0
        public void HandleToDoTemplateRegistration_Status_Abandoned()
        {
            ToDoActivationRule rule = new ToDoActivationRule
            {
                EndpointUtil = new StubEndpointUtils(),
                PlanUtils    = new PlanElementUtils()
            };

            var patientId = ObjectId.GenerateNewId().ToString();

            PlanElementEventArg arg = new PlanElementEventArg
            {
                Program = new Program
                {
                    Id        = ObjectId.GenerateNewId().ToString(),
                    PatientId = patientId
                },
                UserId = "5325c821072ef705080d3488",
                Action = new Actions {
                    Id = ObjectId.GenerateNewId().ToString()
                },
                PatientId   = patientId,
                PlanElement = new Step()
            };

            var se = new SpawnElement
            {
                ElementType = 201,
                ElementId   = "53ff6b92d4332314bcab46e0"
            };

            var type = rule.Execute(arg.UserId, arg, se, new ProgramAttributeData());

            Assert.AreEqual(type, 200);
        }
Пример #3
0
            public void PatientToDoExistsTest_true()
            {
                var todoRule = new ToDoActivationRule
                {
                    EndpointUtil = new EndpointUtils(),
                    PlanUtils    = new StubPlanElementUtils()
                };

                const string patientId = "5325da76d6a4850adcbba656";
                const string userId    = "1234";
                const string elemId    = "5407527d1e6015290c203d36";

                var eventArg = new PlanElementEventArg
                {
                    Action        = new Actions(),
                    DomainRequest =
                        new AppDomainRequest {
                        Version = 1.0, ContractNumber = "InHealth001", UserId = "1234"
                    },
                    PatientId   = patientId,
                    UserId      = userId,
                    PlanElement = new PlanElement {
                        Id = ""
                    }
                };

                var result = todoRule.PatientToDoExists(eventArg, elemId);

                Assert.IsTrue(result);
            }
Пример #4
0
            public void HandleDueDate_Null()
            {
                ToDoActivationRule rule = new ToDoActivationRule();
                var val = rule.HandleDueDate(null);

                Assert.IsNull(val);
            }
Пример #5
0
            public void HandleDueDate_HasRange()
            {
                var days = 10;
                ToDoActivationRule rule = new ToDoActivationRule();
                var duedate             = rule.HandleDueDate(days);

                var nDt   = DateTime.UtcNow.AddDays(days);
                var dDate = new DateTime(nDt.Year, nDt.Month, nDt.Day, 12, 0, 0);

                Assert.AreEqual(duedate, dDate);
            }
Пример #6
0
            public void Execute_ToDo()
            {
                IElementActivationRule rule = new ToDoActivationRule
                {
                    EndpointUtil = new StubEndpointUtils(),
                    PlanUtils    = new NG.Fakes.StubIPlanElementUtils()
                };
                SpawnElement se = new NG.DTO.Fakes.StubSpawnElement {
                    ElementType = 111
                };
                PlanElementEventArg arg = new NG.PlanCOR.Fakes.StubPlanElementEventArg {
                };
                var userid = "999999999999999999999999";
                var result = rule.Execute(userid, arg, se, new ProgramAttributeData());

                Assert.AreEqual(result, "ToDo");
            }
Пример #7
0
            public void SetDefaultAssignment_False()
            {
                var todoRule = new ToDoActivationRule
                {
                    EndpointUtil = new StubEndpointUtils(),
                    PlanUtils    = new StubPlanElementUtils()
                };

                var userid   = "Testing";
                var schedule = new DTO.Scheduling.Schedule
                {
                    DefaultAssignment = false,
                    AssignedToId      = userid,
                    CreatedById       = userid
                };

                var todoData = new DataDomain.Scheduling.DTO.ToDoData();

                todoRule.SetDefaultAssignment(userid, schedule, todoData);

                Assert.AreNotEqual(userid, todoData.AssignedToId);
            }