public void Test_GetRelatedProcedureSteps()
        {
            Procedure procedure = new Procedure();

            // Testing that procedure steps with tied protocols will be related steps
            Protocol protocol = new Protocol(procedure);
            ConcreteProtocolProcedureStep ps1 = new ConcreteProtocolProcedureStep(protocol);

            procedure.AddProcedureStep(ps1);
            ConcreteProtocolProcedureStep ps2 = new ConcreteProtocolProcedureStep(protocol);

            procedure.AddProcedureStep(ps2);

            // expect that each ps is tied by common protocol
            Assert.AreEqual(protocol, ps1.Protocol);
            Assert.AreEqual(protocol, ps2.Protocol);
            Assert.Contains(ps2, ps1.GetRelatedProcedureSteps());
            Assert.Contains(ps1, ps2.GetRelatedProcedureSteps());

            // Testing that the relative has to be a protocol step
            GenericReportingProcedureStep ps3 = new GenericReportingProcedureStep(procedure);

            Assert.IsTrue(procedure.ProcedureSteps.Contains(ps3));

            // expect that the related psteps are not related to the different step
            Assert.IsFalse(ps3.GetRelatedProcedureSteps().Contains(ps1));
            Assert.IsFalse(ps3.GetRelatedProcedureSteps().Contains(ps2));
            Assert.IsFalse(ps1.GetRelatedProcedureSteps().Contains(ps3));
            Assert.IsFalse(ps2.GetRelatedProcedureSteps().Contains(ps3));
        }
        public void Test_Test_AutoCompleteOrderProcedure()
        {
            Order order = TestOrderFactory.CreateOrder(2, 1, true);
            // copy req procs to a list so we can access them by index
            List <Procedure> reqProcs = new List <Procedure>(
                new TypeSafeEnumerableWrapper <Procedure>(order.Procedures));
            Procedure rp1 = reqProcs[0];
            Procedure rp2 = reqProcs[1];


            // cancel rp2
            rp2.Cancel();

            // complete rp1 and publish it
            rp1.ModalityProcedureSteps[0].Complete(TestStaffFactory.CreateStaff(new StaffTypeEnum("STEC", null, null)));

            PublicationStep pub1 = new PublicationStep();

            pub1.ReportPart = new ReportPart(new Report(), 0); // must have a report part or we get null-ref exception
            rp1.AddProcedureStep(pub1);

            pub1.Complete(TestStaffFactory.CreateStaff(new StaffTypeEnum("PRAD", null, null)));

            CheckStatus(ProcedureStatus.CA, rp2);
            Assert.IsNull(rp2.StartTime);
            Assert.IsNotNull(rp2.EndTime);

            CheckStatus(ProcedureStatus.CM, rp1);
            Assert.IsNotNull(rp1.StartTime);
            Assert.IsNotNull(rp1.EndTime);

            CheckStatus(OrderStatus.CM, order);
            Assert.IsNotNull(rp1.StartTime);
            Assert.IsNotNull(rp1.EndTime);
        }
        public void Test_GetRelatedProcedureSteps()
        {
            Procedure  procedure  = new Procedure();
            Report     report     = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 1);

            // Testing that procedure steps with tied report will be related steps
            ConcreteReportingProcedureStep p1 = new ConcreteReportingProcedureStep(procedure, reportPart);
            ConcreteReportingProcedureStep p2 = new ConcreteReportingProcedureStep(procedure, reportPart);

            // expect that each ps is tied by common report
            Assert.AreEqual(report, p1.Report);
            Assert.AreEqual(report, p2.Report);
            Assert.Contains(p2, p1.GetRelatedProcedureSteps());
            Assert.Contains(p1, p2.GetRelatedProcedureSteps());

            // testing that proedure steps with null report will have no relatives
            p1 = new ConcreteReportingProcedureStep(procedure, null);
            p2 = new ConcreteReportingProcedureStep(procedure, null);

            // expect the each ps has no relatives
            Assert.IsEmpty(p1.GetRelatedProcedureSteps());
            Assert.IsEmpty(p2.GetRelatedProcedureSteps());

            // Testing that the relative has to be a report step
            GenericProtocolProcedureStep p3 = new GenericProtocolProcedureStep(new Protocol(procedure));

            procedure.AddProcedureStep(p3);

            // expect that the related psteps are not related to the different step
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p1));
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p2));
            Assert.IsFalse(p1.GetRelatedProcedureSteps().Contains(p3));
            Assert.IsFalse(p2.GetRelatedProcedureSteps().Contains(p3));
        }
Beispiel #4
0
        public void Test_Schedule_PreStep_And_SchedulingOffset()
        {
            var procedure = new Procedure(new ProcedureType(), "111", "1.111");

            var protocolStep = new ProtocolAssignmentStep(new Protocol(procedure));

            procedure.AddProcedureStep(protocolStep);
            var registrationStep  = new RegistrationProcedureStep(procedure);
            var modalityStep      = new ModalityProcedureStep(procedure, "description", new Modality());
            var documentationStep = new DocumentationProcedureStep(procedure);
            var reportingStep     = new ConcreteReportingProcedureStep(procedure);

            Assert.IsNull(protocolStep.Scheduling.StartTime);
            Assert.IsNull(registrationStep.Scheduling.StartTime);
            Assert.IsNull(modalityStep.Scheduling.StartTime);
            Assert.IsNull(documentationStep.Scheduling.StartTime);
            Assert.IsNull(reportingStep.Scheduling.StartTime);

            var now = DateTime.Now;

            procedure.Schedule(now);

            Assert.AreEqual(now.Truncate(DateTimePrecision.Minute), procedure.ScheduledStartTime);
            Assert.AreEqual(protocolStep.CreationTime, protocolStep.Scheduling.StartTime);
            Assert.AreEqual(procedure.ScheduledStartTime, registrationStep.Scheduling.StartTime);
            Assert.AreEqual(procedure.ScheduledStartTime, modalityStep.Scheduling.StartTime);
            Assert.IsNull(documentationStep.Scheduling.StartTime);
            Assert.IsNull(reportingStep.Scheduling.StartTime);
        }
Beispiel #5
0
        public void Test_AddProcedureStep_StepNotScheduling()
        {
            var procedure     = new Procedure();
            var procedureStep = new ModalityProcedureStep(procedure, "New Modality", new Modality());

            procedureStep.Start(new Staff());

            Assert.AreEqual(ActivityStatus.IP, procedureStep.State);

            procedure.AddProcedureStep(procedureStep);
        }
Beispiel #6
0
        private static void AddProcedureSteps(Procedure procedure, int numMps)
        {
            Modality m = new Modality("01", "CT", procedure.PerformingFacility, null, null);

            for (int s = 0; s < numMps; s++)
            {
                ModalityProcedureStep step = new ModalityProcedureStep();
                step.Description = "MPS 10" + s;
                step.Modality    = m;
                procedure.AddProcedureStep(step);
            }
        }
            private void ReplaceAssignmentStep(Procedure procedure, Protocol protocol, Staff reassignToStaff)
            {
                ProtocolAssignmentStep replacementAssignmentStep = new ProtocolAssignmentStep(protocol);

                procedure.AddProcedureStep(replacementAssignmentStep);
                if (reassignToStaff != null)
                {
                    replacementAssignmentStep.Assign(reassignToStaff);
                }

                replacementAssignmentStep.Schedule(Platform.Time);
            }
Beispiel #8
0
        public void Test_AddProcedureStep_StepProcedureNotNull()
        {
            var p1 = new Procedure();
            var ps = new DocumentationProcedureStep();

            Assert.IsNull(ps.Procedure);

            p1.AddProcedureStep(ps);
            Assert.AreEqual(p1, ps.Procedure);

            var p2 = new Procedure();

            p2.AddProcedureStep(ps);
        }
Beispiel #9
0
        public void Test_AddProcedureStep()
        {
            var procedure = new Procedure();

            var ps = new DocumentationProcedureStep();

            Assert.IsFalse(procedure.ProcedureSteps.Contains(ps));
            Assert.AreNotEqual(procedure, ps.Procedure);

            procedure.AddProcedureStep(ps);

            Assert.IsTrue(procedure.ProcedureSteps.Contains(ps));
            Assert.AreEqual(procedure, ps.Procedure);
        }
Beispiel #10
0
        public void Test_GetProcedureSteps()
        {
            var procedure = new Procedure();

            Assert.IsEmpty(procedure.GetProcedureSteps(delegate { return(true); }));

            var ps1 = new DocumentationProcedureStep(procedure);
            var ps2 = new ModalityProcedureStep(procedure, "1", new Modality());
            var ps3 = new ModalityProcedureStep(procedure, "2", new Modality());
            var ps4 = new ProtocolAssignmentStep();

            procedure.AddProcedureStep(ps4);

            Assert.AreEqual(4, procedure.GetProcedureSteps(delegate { return(true); }).Count);
            Assert.IsEmpty(procedure.GetProcedureSteps(delegate { return(false); }));
            Assert.AreEqual(1, procedure.GetProcedureSteps(ps => ps is DocumentationProcedureStep).Count);
            Assert.AreEqual(2, procedure.GetProcedureSteps(ps => ps is ModalityProcedureStep).Count);
            Assert.AreEqual(0, procedure.GetProcedureSteps(ps => ps is ReportingProcedureStep).Count);
            Assert.AreEqual(1, procedure.GetProcedureSteps(ps => ps is ProtocolProcedureStep).Count);
        }
Beispiel #11
0
		public void Test_AddProcedureStep()
		{
			var procedure = new Procedure();

			var ps = new DocumentationProcedureStep();
			Assert.IsFalse(procedure.ProcedureSteps.Contains(ps));
			Assert.AreNotEqual(procedure, ps.Procedure);

			procedure.AddProcedureStep(ps);

			Assert.IsTrue(procedure.ProcedureSteps.Contains(ps));
			Assert.AreEqual(procedure, ps.Procedure);
		}
Beispiel #12
0
        private static void AddProcedureSteps(Procedure procedure, int numMps)
        {
            Modality m = new Modality("01", "CT", procedure.PerformingFacility, null, null);

            for (int s = 0; s < numMps; s++)
            {
                ModalityProcedureStep step = new ModalityProcedureStep();
                step.Description = "MPS 10" + s;
                step.Modality = m;
                procedure.AddProcedureStep(step);
            }
        }
        public void Test_GetRelatedProcedureSteps()
        {
            Procedure procedure = new Procedure();

            // Testing that procedure steps with tied protocols will be related steps
            Protocol protocol = new Protocol(procedure);
            ConcreteProtocolProcedureStep ps1 = new ConcreteProtocolProcedureStep(protocol);
            procedure.AddProcedureStep(ps1);
            ConcreteProtocolProcedureStep ps2 = new ConcreteProtocolProcedureStep(protocol);
            procedure.AddProcedureStep(ps2);

            // expect that each ps is tied by common protocol
            Assert.AreEqual(protocol, ps1.Protocol);
            Assert.AreEqual(protocol, ps2.Protocol);
            Assert.Contains(ps2, ps1.GetRelatedProcedureSteps());
            Assert.Contains(ps1, ps2.GetRelatedProcedureSteps());
            
            // Testing that the relative has to be a protocol step
            GenericReportingProcedureStep ps3 = new GenericReportingProcedureStep(procedure);
            Assert.IsTrue(procedure.ProcedureSteps.Contains(ps3));

            // expect that the related psteps are not related to the different step
            Assert.IsFalse(ps3.GetRelatedProcedureSteps().Contains(ps1));
            Assert.IsFalse(ps3.GetRelatedProcedureSteps().Contains(ps2));
            Assert.IsFalse(ps1.GetRelatedProcedureSteps().Contains(ps3));
            Assert.IsFalse(ps2.GetRelatedProcedureSteps().Contains(ps3));
        }
Beispiel #14
0
		public void Test_Schedule_PreStep_And_SchedulingOffset()
		{
			var procedure = new Procedure(new ProcedureType(), "111", "1.111");

			var protocolStep = new ProtocolAssignmentStep(new Protocol(procedure));
			procedure.AddProcedureStep(protocolStep);
			var registrationStep = new RegistrationProcedureStep(procedure);
			var modalityStep = new ModalityProcedureStep(procedure, "description", new Modality());
			var documentationStep = new DocumentationProcedureStep(procedure);
			var reportingStep = new ConcreteReportingProcedureStep(procedure);

			Assert.IsNull(protocolStep.Scheduling.StartTime);
			Assert.IsNull(registrationStep.Scheduling.StartTime);
			Assert.IsNull(modalityStep.Scheduling.StartTime);
			Assert.IsNull(documentationStep.Scheduling.StartTime);
			Assert.IsNull(reportingStep.Scheduling.StartTime);

			var now = DateTime.Now;
			procedure.Schedule(now);

			Assert.AreEqual(now.Truncate(DateTimePrecision.Minute), procedure.ScheduledStartTime);
			Assert.AreEqual(protocolStep.CreationTime, protocolStep.Scheduling.StartTime);
			Assert.AreEqual(procedure.ScheduledStartTime, registrationStep.Scheduling.StartTime);
			Assert.AreEqual(procedure.ScheduledStartTime, modalityStep.Scheduling.StartTime);
			Assert.IsNull(documentationStep.Scheduling.StartTime);
			Assert.IsNull(reportingStep.Scheduling.StartTime);
		}
Beispiel #15
0
		public void Test_AddProcedureStep_StepNotScheduling()
		{
			var procedure = new Procedure();
			var procedureStep = new ModalityProcedureStep(procedure, "New Modality", new Modality());
			procedureStep.Start(new Staff());

			Assert.AreEqual(ActivityStatus.IP, procedureStep.State);

			procedure.AddProcedureStep(procedureStep);
		}
Beispiel #16
0
		public void Test_AddProcedureStep_StepProcedureNotNull()
		{
			var p1 = new Procedure();
			var ps = new DocumentationProcedureStep();
			Assert.IsNull(ps.Procedure);

			p1.AddProcedureStep(ps);
			Assert.AreEqual(p1, ps.Procedure);

			var p2 = new Procedure();
			p2.AddProcedureStep(ps);
		}
        public void Test_GetRelatedProcedureSteps()
        {
            Procedure procedure = new Procedure();
            Report report = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 1);

            // Testing that procedure steps with tied report will be related steps
            ConcreteReportingProcedureStep p1 = new ConcreteReportingProcedureStep(procedure, reportPart);
            ConcreteReportingProcedureStep p2 = new ConcreteReportingProcedureStep(procedure, reportPart);

            // expect that each ps is tied by common report
            Assert.AreEqual(report, p1.Report);
            Assert.AreEqual(report, p2.Report);
            Assert.Contains(p2, p1.GetRelatedProcedureSteps());
            Assert.Contains(p1, p2.GetRelatedProcedureSteps());

            // testing that proedure steps with null report will have no relatives
            p1 = new ConcreteReportingProcedureStep(procedure, null);
            p2 = new ConcreteReportingProcedureStep(procedure, null);

            // expect the each ps has no relatives
            Assert.IsEmpty(p1.GetRelatedProcedureSteps());
            Assert.IsEmpty(p2.GetRelatedProcedureSteps());

            // Testing that the relative has to be a report step
            GenericProtocolProcedureStep p3 = new GenericProtocolProcedureStep(new Protocol(procedure));
            procedure.AddProcedureStep(p3);

            // expect that the related psteps are not related to the different step
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p1));
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p2));
            Assert.IsFalse(p1.GetRelatedProcedureSteps().Contains(p3));
            Assert.IsFalse(p2.GetRelatedProcedureSteps().Contains(p3));
        }
Beispiel #18
0
		public void Test_GetProcedureSteps()
		{
			var procedure = new Procedure();

			Assert.IsEmpty(procedure.GetProcedureSteps(delegate { return true; }));

			var ps1 = new DocumentationProcedureStep(procedure);
			var ps2 = new ModalityProcedureStep(procedure, "1", new Modality());
			var ps3 = new ModalityProcedureStep(procedure, "2", new Modality());
			var ps4 = new ProtocolAssignmentStep();
			procedure.AddProcedureStep(ps4);

			Assert.AreEqual(4, procedure.GetProcedureSteps(delegate { return true; }).Count);
			Assert.IsEmpty(procedure.GetProcedureSteps(delegate { return false; }));
			Assert.AreEqual(1, procedure.GetProcedureSteps(ps => ps is DocumentationProcedureStep).Count);
			Assert.AreEqual(2, procedure.GetProcedureSteps(ps => ps is ModalityProcedureStep).Count);
			Assert.AreEqual(0, procedure.GetProcedureSteps(ps => ps is ReportingProcedureStep).Count);
			Assert.AreEqual(1, procedure.GetProcedureSteps(ps => ps is ProtocolProcedureStep).Count);
		}