Example #1
0
        public void PressingCycleHoldWithDoorOpenCausesError()
        {
            ManualChecklist          checklist = new ManualChecklist();
            ManualChecklistValidator validator = new ManualChecklistValidator(checklist);

            validator.onError   += err => Assert.Pass(err);
            validator.onPass    += (TaskType t, bool compl) => checklist.SetTaskCompletion(t, compl);
            validator.onSuccess += () => Assert.Fail("passed");

            validator.Validate(TaskType.NoSafetyMat, true);
            validator.Validate(TaskType.NoLightRays, true);
            validator.Validate(TaskType.CycleHoldPressed, true);
            Assert.Fail("No Event Triggered.");
        }
Example #2
0
        public void PressingInterruptorAutomaticCausesError()
        {
            ManualChecklist          checklist = new ManualChecklist();
            ManualChecklistValidator validator = new ManualChecklistValidator(checklist);

            validator.onError   += err => Assert.Pass(err);
            validator.onPass    += (TaskType t, bool compl) => checklist.SetTaskCompletion(t, compl);
            validator.onSuccess += () => Assert.Fail("passed");

            validator.Validate(TaskType.NoSafetyMat, true);
            validator.Validate(TaskType.NoLightRays, true);
            validator.Validate(TaskType.InterruptorAutomatic, true);
            Assert.Fail("reached end");
        }
Example #3
0
        public void ManualModeHappyPath()
        {
            ManualChecklist          checklist = new ManualChecklist();
            ManualChecklistValidator validator = new ManualChecklistValidator(checklist);

            validator.onFail    += () => Assert.Fail("failed");
            validator.onError   += err => Assert.Fail(err);
            validator.onPass    += (TaskType t, bool compl) => checklist.SetTaskCompletion(t, compl);
            validator.onSuccess += () => Assert.Pass("passed");

            validator.Validate(TaskType.NoSafetyMat, true);
            validator.Validate(TaskType.NoLightRays, true);
            validator.Validate(TaskType.DoorClosed, true);
            validator.Validate(TaskType.CycleHoldPressed, true);
            validator.Validate(TaskType.InterruptorManual, true);
            validator.Validate(TaskType.RobotT1, true);
            validator.Validate(TaskType.RobotFixed, true);
            validator.Validate(TaskType.InterruptorAutomatic, true);
            validator.Validate(TaskType.ResetPressed, true);
            Assert.Fail("No Event Triggered.");
        }