예제 #1
0
        public void ShouldFailPassingLightRays()
        {
            AutomaticChecklist          checklist = new AutomaticChecklist();
            AutomaticChecklistValidator validator = new AutomaticChecklistValidator(checklist);

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

            validator.Validate(TaskType.NoSafetyMat, true);
            validator.Validate(TaskType.NoLightRays, false);
            Assert.Fail("no event triggered");
        }
예제 #2
0
        public void ShouldFailResetPressedWithNoPiece()
        {
            AutomaticChecklist          checklist = new AutomaticChecklist();
            AutomaticChecklistValidator validator = new AutomaticChecklistValidator(checklist);

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

            validator.Validate(TaskType.NoSafetyMat, true);
            validator.Validate(TaskType.NoLightRays, true);
            validator.Validate(TaskType.DoorClosed, true);
            validator.Validate(TaskType.InterruptorAutomatic, true);
            validator.Validate(TaskType.ResetPressed, true);
            Assert.Fail("no event triggered");
        }
예제 #3
0
        public void AutomaticModeHappyPath()
        {
            AutomaticChecklist          checklist = new AutomaticChecklist();
            AutomaticChecklistValidator validator = new AutomaticChecklistValidator(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.PiecePlaced, true);
            validator.Validate(TaskType.InterruptorAutomatic, true);
            validator.Validate(TaskType.ResetPressed, true);
            validator.Validate(TaskType.CycleStartPressed, true);
            validator.Validate(TaskType.PieceInBox, true);
            Assert.Fail("no event triggered");
        }