public CandidateTest CreateCandidateTest(Candidate candidate)
        {
            CandidateTest candidateTest;

            try
            {
                FetchCandidateTest(candidate);
                throw new BusinessRuleException("Candidate already exists in the Test Instance");
            }
            catch (RecordNotFoundException)
            {
                if (IsPractice)
                    candidateTest = new PracticeTest(candidate);
                else
                    candidateTest = new ActualTest(candidate);

                CandidateTests.Add(candidateTest);
                return candidateTest;
            }
        }
 public PracticeTest(Candidate candidate)
     : base(candidate)
 {
 }
示例#3
0
 private void ChangeCandidateStatus(Candidate candidate, bool isActive)
 {
     if (candidate.HasPendingExams || candidate.HasInProgressExams)
     {
         throw new BusinessRuleException("Unable to deactivate candidate while it has a pending or in progress exam.");
     }
     candidate.Active = isActive;
 }
 public CandidateTest FetchCandidateTest(Candidate candidate)
 {
     return FetchCandidateTest(candidate.Id);
 }
示例#5
0
 public void DeleteCandidate(Action action, Candidate candidate)
 {
     ThrowBusinessRuleViolationForCandidate(candidate);
     action();
 }
示例#6
0
 public void ThrowBusinessRuleViolationForCandidate(Candidate candidate)
 {
     if (candidate.HadTakenExam)
         throw new BusinessRuleException("Candidate is already in the Candidate Test. Cannot be modified.");
 }
示例#7
0
 public Candidate CreateCandidate(string studentNumber)
 {
     try
     {
        FetchCandidate(studentNumber);
        throw new BusinessRuleException("Candidate already exists");
     }
     catch (RecordNotFoundException)
     {
         var result = new Candidate(studentNumber);
         People.Add(result);
         return result;
     }
 }
示例#8
0
 public ActualTest(Candidate candidate)
     : base(candidate)
 {
 }
示例#9
0
 private void deleteCandidate(Candidate candidate)
 {
     _context.People.Remove(candidate);
 }
示例#10
0
 public CandidateTest(Candidate candidate)
     : this()
 {
     Candidate = candidate;
     StateId = 1; //Set the state to be scheduled when a new object (instance) is first created
 }
示例#11
0
 public CandidateTest CreateCandidateTest(Guid instanceId, Candidate candidate)
 {
     return FetchTestInstance(instanceId).CreateCandidateTest(candidate);
 }