public async Task GetAllSkills_ReturnsAllSkills_Always()
        {
            //Arrange

            var cSharp = new Skill()
            {
                Id = Guid.NewGuid().ToString(), Name = "C#"
            };
            var javascript = new Skill()
            {
                Id = Guid.NewGuid().ToString(), Name = "javascript"
            };

            await _skillRepository.UpsertAsync(cSharp);

            await _skillRepository.UpsertAsync(javascript);

            //Act
            var skills = await _skillsService.GetAllSkillsAsync();

            //Assert
            Assert.AreEqual(2, skills.Count());
            Assert.AreEqual(cSharp, skills.First());
            Assert.AreEqual(javascript, skills.Last());
        }
        public async Task CreateRecruiter_SaveCruiterSuccessfully_WhenRecruiterDataIsCorrectAndRecruiterNotExists()
        {
            //Arrange
            var recruiter = new Recruiter()
            {
                FirstName    = "Patricia",
                LastName     = "Maidana",
                IdentityCard = "28123456"
            };

            recruiter.AddClientCompany(new Company("Acme", "Software"));

            recruiter.SetPreviousJob(new Job("Accenture", "Sr.Talent Adquision", new DateTime(2015, 5, 1), true));
            recruiter.SetPreviousJob(new Job("Accenture", "Sr.Talent Adquision", new DateTime(2014, 1, 1), false, new DateTime(2015, 4, 30)));

            recruiter.SetStudy(new Study("UBA", "Lic.Relaciones del Trabajo", StudyStatus.Completed));

            var cSharp = new Skill()
            {
                Name = "C#"
            };
            var javascript = new Skill()
            {
                Name = "Javascript"
            };
            var react = new Skill()
            {
                Name = "React"
            };

            await _skillRepository.UpsertAsync(cSharp);

            await _skillRepository.UpsertAsync(javascript);

            await _skillRepository.UpsertAsync(react);

            recruiter.SetAbility(new Ability(cSharp, 10));
            recruiter.SetAbility(new Ability(javascript, 8));
            recruiter.SetAbility(new Ability(react, 7));

            //Act
            await _service.CreateRecruiterAsync(recruiter);

            var savedRecruiter = await _service.GetRecruiterAsync(recruiter);

            //Assert
            Assert.AreEqual(recruiter, savedRecruiter, "Recruiter was not saved");
        }
示例#3
0
        public async Task CreateSkill(Skill skill)
        {
            skill.Validate();

            await _skillRepository.UpsertAsync(skill);
        }
示例#4
0
        private static void Main(string[] args)
        {
            var mongoClient = new MongoClient();

            mongoClient.DropDatabase("JobOfferDatabase");
            var database = mongoClient.GetDatabase("JobOfferDatabase");

            var cSharp = new Skill()
            {
                Name = "C#"
            };
            var javascript = new Skill()
            {
                Name = "Javascript"
            };
            var react = new Skill()
            {
                Name = "React"
            };
            var docker = new Skill()
            {
                Name = "Docker"
            };
            var java = new Skill()
            {
                Name = "Java"
            };

            var skillRepository = new SkillRepository(database);

            Task.Run(async() => await skillRepository.UpsertAsync(cSharp)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(javascript)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(react)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(docker)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(java)).Wait();

            var companyRepository   = new CompanyRepository(database);
            var recruiterRepository = new RecruiterRepository(database);
            var jobOfferRepository  = new JobOfferRepository(database);
            var personRepository    = new PersonRepository(database);
            var accountRepository   = new AccountRepository(database);

            var recruiterService = new RecruiterService(companyRepository, recruiterRepository, jobOfferRepository, personRepository, accountRepository);

            var recruiter = new Recruiter();

            recruiter.AddClient(new Company("Acme", "Software"));

            recruiter.IdentityCard = "28.999.999";
            recruiter.FirstName    = "Patricia";
            recruiter.LastName     = "Maidana";
            recruiter.SetStudy(new Study("UBA", "Lic.RRHH", StudyStatus.Completed));
            recruiter.SetPreviousJob(new Job("Coto", "HR Analyst", DateTime.Now.AddYears(-6), true));

            recruiter.SetAbility(new Ability(javascript, 9));

            var company1 = new Company("Acme", "software");

            companyRepository.UpsertAsync(company1).Wait();

            recruiterService.CreateRecruiterAsync(recruiter).Wait();

            var jobOffer = Task.Run(() =>
            {
                RecruiterService recruiterService1 = recruiterService;
                return(recruiterService1.GetNewJobOffer(recruiter.Id));
            }).Result;

            jobOffer.Date      = DateTime.Now.Date;
            jobOffer.Title     = "Analista programador";
            jobOffer.CompanyId = company1.Id;
            jobOffer.Zone      = "Palermo";

            jobOffer.Description = "Para importante empresa ubicada en San Telmo, estamos en búsqueda de desarrollador fullstack con " +
                                   "al menos 3 años de experiencia utilizando React y NodeJs.Quien se incorpore estará participando dentro " +
                                   "de un proyecto de inteligencia artifical";

            jobOffer.AddSkillRequired(new SkillRequired(javascript, 5, true));
            jobOffer.AddSkillRequired(new SkillRequired(react, 3));

            jobOffer.Language            = "Ingles";
            jobOffer.LanguageLevel       = LanguageLevel.Advance;
            jobOffer.IsLanguageMandatory = true;

            jobOffer.ContractInformation = new ContractCondition()
            {
                StartingFrom   = "Inmediata",
                KindOfContract = "Relación de dependencia",
                WorkingDays    = "Lunes a viernes 9 a 18"
            };

            recruiterService.SaveJobOfferAsync(jobOffer).Wait();

            //

            var company2 = new Company("KaizenRH", "software");

            companyRepository.UpsertAsync(company2).Wait();

            var jobOffer2 = Task.Run(() => recruiterService.GetNewJobOffer(recruiter.Id)).Result;

            jobOffer2.Date      = DateTime.Now.Date;
            jobOffer2.Title     = "JAVA Full Stack Developer";
            jobOffer2.CompanyId = company2.Id;
            jobOffer2.Zone      = "Las Cañitas";

            jobOffer2.Description = "En KaizenRH buscamos Python Developer Junior para trabajar en interesantes proyectos dentro de Startup en expansión LATAM dedicada a la automatización de procesos IT y negocios.";

            jobOffer2.AddSkillRequired(new SkillRequired(javascript, 5, true));
            jobOffer2.AddSkillRequired(new SkillRequired(react, 3));
            jobOffer2.AddSkillRequired(new SkillRequired(java, 6, true));

            jobOffer2.Language      = "Ingles";
            jobOffer2.LanguageLevel = LanguageLevel.Intermediate;

            jobOffer2.ContractInformation = new ContractCondition()
            {
                StartingFrom   = "Inmediata",
                KindOfContract = "Relación de dependencia",
                WorkingDays    = "Lunes a viernes 9 a 18"
            };

            recruiterService.SaveJobOfferAsync(jobOffer2).Wait();

            //

            var company3 = new Company("ADN Recursos Humanos", "Seleccion de personal");

            companyRepository.UpsertAsync(company3).Wait();

            var jobOffer3 = Task.Run(() => recruiterService.GetNewJobOffer(recruiter.Id)).Result;

            jobOffer3.Date      = DateTime.Now.Date;
            jobOffer3.Title     = "Sr. C# Backend Developer/Engineer";
            jobOffer3.CompanyId = company3.Id;
            jobOffer3.Zone      = "Microcentro";

            jobOffer3.Description = "ADN - Recursos Humanos estamos en la búsqueda de un Sr. Python Backend Developer/Engineer, para Importante Empresa de Tecnología";

            jobOffer3.AddSkillRequired(new SkillRequired(cSharp, 5));
            jobOffer3.AddSkillRequired(new SkillRequired(javascript, 2, true));

            jobOffer3.ContractInformation = new ContractCondition()
            {
                StartingFrom   = "Inmediata",
                KindOfContract = "Relación de dependencia",
                WorkingDays    = "Lunes a viernes 9 a 18"
            };

            recruiterService.SaveJobOfferAsync(jobOffer3).Wait();


            recruiterService.PublishJobOffer(jobOffer2).Wait();
            recruiterService.PublishJobOffer(jobOffer3).Wait();
            recruiterService.FinishJobOffer(jobOffer3).Wait();

            var pRepo = new RecruiterRepository(database);
            var aRepo = new AccountRepository(database);

            var person = pRepo.GetByIdentityCardAsync("28.999.999").Result;

            var account = new Account()
            {
                Id = Guid.NewGuid().ToString(), PersonId = person.Id, Email = "*****@*****.**", Password = "******", IsRecruiter = true
            };

            aRepo.UpsertAsync(account).Wait();

            Console.WriteLine("Agregado correctamente!");
            Console.ReadKey();
        }