Пример #1
0
 public IEnumerable <Candidate> Get()
 {
     if (_candidateList == null)
     {
         _candidateList = _candidateRepository.Get().ToList();
     }
     return(_candidateList);
 }
        public void GivenExistingCandidateId_WhenSearchId_ThenReturnCandidate()
        {
            using (var context = new SwintakeContext(_options))
            {
                var guidId  = Guid.NewGuid();
                var janneke = new CandidateBuilder()
                              .WithId(guidId)
                              .WithFirstName("Janneke")
                              .WithLastName("Janssens")
                              .WithEmail("*****@*****.**")
                              .WithPhoneNumber("0470000000")
                              .WithGitHubUsername("janneke")
                              .WithLinkedIn("janneke")
                              .Build();

                IRepository <Candidate> candidateRepository = new CandidateRepository(context);

                //when
                candidateRepository.Save(janneke);
                Candidate searchCandidate = candidateRepository.Get(guidId);

                //then
                Assert.Equal(janneke.Id.ToString(), searchCandidate.Id.ToString());
            }
        }
        public void GivenNonExistingCandidateId_WhenSearchId_ThenReturnNull()
        {
            using (var context = new SwintakeContext(_options))
            {
                IRepository <Candidate> candidateRepository = new CandidateRepository(context);
                Candidate searchCandidate = candidateRepository.Get(Guid.NewGuid());

                //then
                Assert.Null(searchCandidate);
            }
        }