Ejemplo n.º 1
0
        public void GivenNewJobApplicationWithExistingCampaignIdAnCandidateId_whenAddJobApplication_ThenCallToJobApplicationRepository()
        {
            //Given
            var janneke = new CandidateBuilder()
                          .WithId(Guid.NewGuid())
                          .WithFirstName("Janneke")
                          .WithLastName("Janssens")
                          .WithEmail("*****@*****.**")
                          .WithPhoneNumber("0470000000")
                          .WithGitHubUsername("janneke")
                          .WithLinkedIn("janneke")
                          .Build();

            var testCampaign = new CampaignBuilder()
                               .WithId(Guid.NewGuid())
                               .WithName("testName")
                               .WithClient("testClient")
                               .WithStatus(CampaignStatus.Active)
                               .WithStartDate(DateTime.Today.AddDays(5))
                               .WithClassStartDate(DateTime.Today.AddDays(5))
                               .WithComment("testComment")
                               .Build();

            var newJobApplication = new JobApplicationBuilder()
                                    .WithId(Guid.NewGuid())
                                    .WithCandidateId(janneke.Id)
                                    .WithCampaignId(testCampaign.Id)
                                    .WithStatus(StatusJobApplication.Active)
                                    .Build();

            _candidateService.GetCandidateById(newJobApplication.CandidateId.ToString()).Returns(janneke);
            _campaignService.GetCampaignByID(newJobApplication.CampaignId.ToString()).Returns(testCampaign);

            //When
            _jobApplicationService.AddJobApplication(newJobApplication);

            //Then
            _jobApplicationRepository.Received().Save(newJobApplication);
        }