Example #1
0
        public async Task AddClientAsync_SaveCompanySuccessfullyAndAddsCompanyToRecruiterClients_WhenCompanyDataIsCorrectAndCompanyDoesNotExists()
        {
            //Arrange
            var recruiter = new Recruiter()
            {
                FirstName    = "Patricia",
                LastName     = "Maidana",
                IdentityCard = "28123456"
            };

            await _recruiterService.CreateRecruiterAsync(recruiter);

            var company = new Company("Acme", "Software");

            //Act
            await _recruiterService.AddClientAsync(company, recruiter.Id);

            var savedCompany = await _companyRepository.GetByIdAsync(company.Id);

            recruiter = await _recruiterRepository.GetByIdAsync(recruiter.Id);

            //Assert
            Assert.AreEqual(company, savedCompany, "Company was not saved");
            Assert.IsTrue(recruiter.ClientCompanies.Any(item => item == company.Id), "Company was not added to client list");
        }