public void ShouldHandlePartials()
        {
            SimpleCarePlanService scp = new SimpleCarePlanService();

            ApplicationServiceContext.Current = this;
            // Patient that is just born = Schedule OPV
            Patient newborn = new Patient()
            {
                Key           = Guid.NewGuid(),
                DateOfBirth   = DateTime.Now,
                GenderConcept = new Core.Model.DataTypes.Concept()
                {
                    Mnemonic = "FEMALE"
                }
            };

            // Now apply the protocol
            var    acts           = scp.CreateCarePlan(newborn);
            var    jsonSerializer = new JsonViewModelSerializer();
            String json           = jsonSerializer.Serialize(newborn);

            Assert.AreEqual(83, acts.Action.Count());
            Assert.IsFalse(acts.Action.Any(o => o.Protocols.Count() > 1));
            acts = scp.CreateCarePlan(newborn);
            //Assert.AreEqual(60, acts.Action.Count());
            acts.Action.RemoveAll(o => o is QuantityObservation);
            Assert.AreEqual(23, acts.Action.Count);
            acts = scp.CreateCarePlan(newborn);
            //Assert.AreEqual(60, acts.Action.Count());
            Assert.AreEqual(83, acts.Action.Count());
            Assert.IsFalse(acts.Action.Any(o => !o.Participations.Any(p => p.ParticipationRoleKey == ActParticipationKey.RecordTarget)));
        }
        public void ShouldExcludeAdults()
        {
            SimpleCarePlanService scp = new SimpleCarePlanService();

            ApplicationServiceContext.Current = this;
            // Patient that is just born = Schedule OPV
            Patient adult = new Patient()
            {
                Key           = Guid.NewGuid(),
                DateOfBirth   = DateTime.Now.AddMonths(-240),
                GenderConcept = new Core.Model.DataTypes.Concept()
                {
                    Mnemonic = "FEMALE"
                }
            };

            // Now apply the protocol
            var    acts           = scp.CreateCarePlan(adult);
            var    jsonSerializer = new JsonViewModelSerializer();
            String json           = jsonSerializer.Serialize(adult);

            Assert.AreEqual(0, acts.Action.Count());
        }
        public void ShouldScheduleAppointments()
        {
            SimpleCarePlanService scp = new SimpleCarePlanService();

            ApplicationServiceContext.Current = this;
            // Patient that is just born = Schedule OPV
            Patient newborn = new Patient()
            {
                Key           = Guid.NewGuid(),
                DateOfBirth   = DateTime.Now,
                GenderConcept = new Core.Model.DataTypes.Concept()
                {
                    Mnemonic = "FEMALE"
                }
            };

            // Now apply the protocol
            var    acts           = scp.CreateCarePlan(newborn, true);
            var    jsonSerializer = new JsonViewModelSerializer();
            string json           = jsonSerializer.Serialize(newborn);

            Assert.AreEqual(60, acts.Action.Count());
            Assert.IsFalse(acts.Action.Any(o => o.Protocols.Count() > 1));
        }