public void TestCreateResumeFile()
        {
            var candidateId = Guid.NewGuid();

            _candidatesCommand.CreateCandidate(new Candidate {
                Id = candidateId
            });

            var file = _filesCommand.CreateTestFile(FileType.Resume);
            var resumeFileReference = new ResumeFileReference {
                FileReferenceId = file.Id
            };

            _candidateResumeFilesCommand.CreateResumeFile(candidateId, resumeFileReference);

            Assert.AreNotEqual(Guid.Empty, resumeFileReference.Id);
            Assert.AreNotEqual(DateTime.MinValue, resumeFileReference.UploadedTime);
            Assert.AreNotEqual(DateTime.MinValue, resumeFileReference.LastUsedTime);

            AssertResumeFile(resumeFileReference, _candidateResumeFilesQuery.GetResumeFile(candidateId, file.Id));
            var resumeFileReferences = _candidateResumeFilesQuery.GetResumeFiles(candidateId);

            Assert.AreEqual(1, resumeFileReferences.Count);
            AssertResumeFile(resumeFileReference, resumeFileReferences[0]);
            AssertResumeFile(resumeFileReference, _candidateResumeFilesQuery.GetLastUsedResumeFile(candidateId));
        }
Esempio n. 2
0
        private ResumeFileModel GetLastUsedResumeFile(IHasId <Guid> member)
        {
            if (member == null)
            {
                return(null);
            }
            var resumeFile = _candidateResumeFilesQuery.GetLastUsedResumeFile(member.Id);

            if (resumeFile == null)
            {
                return(null);
            }
            var fileReference = _filesQuery.GetFileReference(resumeFile.FileReferenceId);

            if (fileReference == null)
            {
                return(null);
            }

            return(new ResumeFileModel
            {
                FileReferenceId = resumeFile.FileReferenceId,
                FileName = fileReference.FileName,
            });
        }
Esempio n. 3
0
        private string GetLastUsedResumeFileName(Guid applicantId)
        {
            var resumeFile = _candidateResumeFilesQuery.GetLastUsedResumeFile(applicantId);

            if (resumeFile == null)
            {
                return(null);
            }
            var fileReference = _filesQuery.GetFileReference(resumeFile.FileReferenceId);

            return(fileReference == null ? null : fileReference.FileName);
        }
Esempio n. 4
0
        private Guid GetLastUsedResumeFileId(Guid memberId)
        {
            var lastUsedResumeFile = _candidateResumeFilesQuery.GetLastUsedResumeFile(memberId);

            if (lastUsedResumeFile == null)
            {
                throw new NoResumeFileException();
            }

            // Update it to indicate that it is being used again.

            _candidateResumeFilesCommand.UpdateLastUsedTime(lastUsedResumeFile);
            return(lastUsedResumeFile.FileReferenceId);
        }