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"); }
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"); }
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"); }