public void Configure(IStateConfigurationBuilder <StudentTestSession> builder) { builder .Configure() .From(StudentTestSessionState.Pending) .To(StudentTestSessionState.Started) .WithTrigger(StudentTestSessionTriggers.StartTest) .WithGuard <TestSessionIsStartedGuard>() .WithGuard <CurrentUserIsOwnerGuard>() .Use <StartStudentTestSession>(); builder .Configure() .From(StudentTestSessionState.Pending) .To(StudentTestSessionState.Ended) .WithTrigger(StudentTestSessionTriggers.OverdueTest) .WithGuard <CurrentUserIsTestSessionOwner>(); builder .Configure() .From(StudentTestSessionState.Started) .To(StudentTestSessionState.Ended) .WithTrigger(StudentTestSessionTriggers.EndTest) .WithGuard <CurrentUserIsOwnerOrTestSessionOwnerGuard>(); }
public void Configure(IStateConfigurationBuilder <TestSession> builder) { builder.Configure() .From(TestSessionState.Pending) .To(TestSessionState.Started) .WithTrigger(TestSessionTriggers.StartTest) .WithGuard <InstructorIsOwner>(); builder.Configure() .From(TestSessionState.Started) .To(TestSessionState.Assessment) .WithTrigger(TestSessionTriggers.StartAssessment) .WithGuard <InstructorIsOwner>() .Use <StartAssessmentPhaseHandler>(); builder.Configure() .From(TestSessionState.Assessment) .To(TestSessionState.Ended) .WithTrigger(TestSessionTriggers.EndTest) .WithGuard <InstructorIsOwner>(); }