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_Constructor_PreviousStep()
        {
            InterpretationStep previousStep = new InterpretationStep(new Procedure());
            PublicationStep    newStep      = new PublicationStep(previousStep);

            Assert.AreEqual(0, newStep.FailureCount);
            Assert.IsNull(newStep.LastFailureTime);
        }
Exemple #3
0
        public void Test_Constructor_PreviousStep()
        {
            InterpretationStep previousStep = new InterpretationStep(new Procedure());
            PublicationStep newStep = new PublicationStep(previousStep);

            Assert.AreEqual(0, newStep.FailureCount);
            Assert.IsNull(newStep.LastFailureTime);
        }
Exemple #4
0
			protected PublicationStep CreateScheduledPublicationStep(Staff executingStaff, VerificationStep verification)
			{
				var settings = new ReportingWorkflowSettings();

				var publication = new PublicationStep(verification);
				publication.Assign(executingStaff);
				publication.Schedule(Platform.Time.AddSeconds(settings.PublicationDelay));

				return publication;
			}
        public void Test_Reassign()
        {
            InterpretationStep previousStep  = new InterpretationStep(new Procedure());
            PublicationStep    procedureStep = new PublicationStep(previousStep);

            PublicationStep newStep = (PublicationStep)procedureStep.Reassign(new Staff());

            Assert.AreEqual(procedureStep, newStep);
            Assert.IsInstanceOf(typeof(PublicationStep), newStep);
        }
Exemple #6
0
 public void Execute(PublicationStep step, Staff executingStaff, IWorkflow workflow)
 {
     if (step.AssignedStaff != null)
     {
         step.Complete(executingStaff);
     }
     else
     {
         step.Complete();
     }
 }
Exemple #7
0
            protected PublicationStep CreateScheduledPublicationStep(Staff executingStaff, VerificationStep verification)
            {
                var settings = new ReportingWorkflowSettings();

                var publication = new PublicationStep(verification);

                publication.Assign(executingStaff);
                publication.Schedule(Platform.Time.AddSeconds(settings.PublicationDelay));

                return(publication);
            }
Exemple #8
0
        public void Test_Fail()
        {
            PublicationStep procedureStep = new PublicationStep();
            Assert.AreEqual(0, procedureStep.FailureCount);
            Assert.IsNull(procedureStep.LastFailureTime);

            procedureStep.Fail();

            Assert.AreEqual(1, procedureStep.FailureCount);
            Assert.IsTrue(RoughlyEqual(procedureStep.LastFailureTime, Platform.Time));

            procedureStep.Fail();

            Assert.AreEqual(2, procedureStep.FailureCount);
            Assert.IsTrue(RoughlyEqual(procedureStep.LastFailureTime, Platform.Time));
        }
        public void Test_Fail()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.AreEqual(0, procedureStep.FailureCount);
            Assert.IsNull(procedureStep.LastFailureTime);

            procedureStep.Fail();

            Assert.AreEqual(1, procedureStep.FailureCount);
            Assert.IsTrue(RoughlyEqual(procedureStep.LastFailureTime, Platform.Time));

            procedureStep.Fail();

            Assert.AreEqual(2, procedureStep.FailureCount);
            Assert.IsTrue(RoughlyEqual(procedureStep.LastFailureTime, Platform.Time));
        }
Exemple #10
0
            public InterpretationStep Execute(PublicationStep step, Staff executingStaff, IWorkflow workflow)
            {
                // Discontinue the publication step
                step.Discontinue();

                // Create a new interpreatation step that uses the same report part
                var interpretationStep = new InterpretationStep(step);

                // Reset the verifier
                interpretationStep.ReportPart.Verifier = null;

                // Assign the new step back to me
                interpretationStep.Assign(executingStaff);
                interpretationStep.Schedule(Platform.Time);

                workflow.AddEntity(interpretationStep);
                return(interpretationStep);
            }
        public void Test_Complete()
        {
            Procedure  procedure  = new Procedure();
            Report     report     = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 0);

            // This modality procedure step is created such that when the procedure tries to update its status
            // the detection of no ModalityProcedureSteps makes any procedure trying to update its status set itself
            // to discontinued, which for this test, is undesirable, this situation will probably never happen
            // in practice.
            ModalityProcedureStep modalityStep = new ModalityProcedureStep(procedure, "New modality.", new Modality());

            InterpretationStep previousStep = new InterpretationStep(procedure);

            previousStep.ReportPart = reportPart;
            PublicationStep procedureStep = new PublicationStep(previousStep);

            procedureStep.Start(new Staff());

            Assert.AreEqual(ActivityStatus.IP, procedureStep.State);
            Assert.AreEqual(0, procedureStep.ReportPart.Index);
            Assert.AreEqual(ReportPartStatus.D, procedureStep.ReportPart.Status);
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                              delegate(Procedure p)
            {
                return(p.Status == ProcedureStatus.IP);
            }));

            procedureStep.Complete();

            Assert.AreEqual(ActivityStatus.CM, procedureStep.State);
            Assert.AreEqual(ReportPartStatus.F, procedureStep.ReportPart.Status);
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                              delegate(Procedure p)
            {
                return(p.Status == ProcedureStatus.CM);
            }));
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                              delegate(Procedure p)
            {
                return(p.EndTime == procedureStep.EndTime);
            }));
        }
Exemple #12
0
        public void Test_Name()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.AreEqual("Publication", procedureStep.Name);
        }
Exemple #13
0
			public void Execute(PublicationStep step, Staff executingStaff, IWorkflow workflow)
			{
				if (step.AssignedStaff != null)
					step.Complete(executingStaff);
				else
					step.Complete();
			}
        public void Test_LastFailureTime()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.IsNull(procedureStep.LastFailureTime);
        }
        public void Test_FailureCount()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.AreEqual(0, procedureStep.FailureCount);
        }
        public void Test_Name()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.AreEqual("Publication", procedureStep.Name);
        }
Exemple #17
0
        public void Test_LastFailureTime()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.IsNull(procedureStep.LastFailureTime);
        }
Exemple #18
0
        public void Test_Reassign()
        {
            InterpretationStep previousStep = new InterpretationStep(new Procedure());
            PublicationStep procedureStep = new PublicationStep(previousStep);

            PublicationStep newStep = (PublicationStep)procedureStep.Reassign(new Staff());

            Assert.AreEqual(procedureStep, newStep);
            Assert.IsInstanceOfType(typeof(PublicationStep), newStep);
        }
Exemple #19
0
        public void Test_FailureCount()
        {
            PublicationStep procedureStep = new PublicationStep();

            Assert.AreEqual(0, procedureStep.FailureCount);
        }
Exemple #20
0
        public void Test_Complete()
        {
            Procedure procedure = new Procedure();
            Report report = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 0);

            // This modality procedure step is created such that when the procedure tries to update its status
            // the detection of no ModalityProcedureSteps makes any procedure trying to update its status set itself
            // to discontinued, which for this test, is undesirable, this situation will probably never happen
            // in practice.
            ModalityProcedureStep modalityStep = new ModalityProcedureStep(procedure, "New modality.", new Modality());

            InterpretationStep previousStep = new InterpretationStep(procedure);
            previousStep.ReportPart = reportPart;
            PublicationStep procedureStep = new PublicationStep(previousStep);
            
            procedureStep.Start(new Staff());

            Assert.AreEqual(ActivityStatus.IP, procedureStep.State);
            Assert.AreEqual(0, procedureStep.ReportPart.Index);
            Assert.AreEqual(ReportPartStatus.D, procedureStep.ReportPart.Status);
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                delegate(Procedure p)
                {
                    return p.Status == ProcedureStatus.IP;
                }));

            procedureStep.Complete();

            Assert.AreEqual(ActivityStatus.CM, procedureStep.State);
            Assert.AreEqual(ReportPartStatus.F, procedureStep.ReportPart.Status);
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                delegate(Procedure p)
                {
                    return p.Status == ProcedureStatus.CM;
                }));
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                delegate(Procedure p)
                {
                    return p.EndTime == procedureStep.EndTime;
                }));
        }
Exemple #21
0
			public InterpretationStep Execute(PublicationStep step, Staff executingStaff, IWorkflow workflow)
			{
				// Discontinue the publication step
				step.Discontinue();

				// Create a new interpreatation step that uses the same report part
				var interpretationStep = new InterpretationStep(step);

				// Reset the verifier
				interpretationStep.ReportPart.Verifier = null;

				// Assign the new step back to me
				interpretationStep.Assign(executingStaff);
				interpretationStep.Schedule(Platform.Time);

				workflow.AddEntity(interpretationStep);
				return interpretationStep;
			}