public void ValidEntities()
        {
            Candidate candidate = new Candidate()
            {
                Name         = "Walter",
                Email        = "*****@*****.**",
                CPFRecipient = "44166763871",
                CrudLink     = "www.github.com\\walter",
                Portfolio    = "www.github.com\\walter",
                Cellphone    = "999999999"
            };

            var result = validator.Validate(candidate);

            Assert.True(result.IsValid);
        }
        public IActionResult Post([FromBody] CandidateViewModel candidateVM)
        {
            var candidate = Mapper.Map <CandidateViewModel, Candidate>(candidateVM);

            var validator = new CandidateValidator();
            var result    = validator.Validate(candidate);


            if (result.IsValid)
            {
                _candidateRepository.Insert(candidate);
                return(Ok());
            }
            else
            {
                return(BadRequest(result.Errors));
            }
        }
        public IActionResult Put([FromBody] CandidateViewModel candidateVM, string id)
        {
            candidateVM.Id = new Guid(id);
            var candidate = Mapper.Map <CandidateViewModel, Candidate>(candidateVM);

            var validator = new CandidateValidator();
            var result    = validator.Validate(candidate);


            if (result.IsValid)
            {
                _candidateRepository.Update(candidate);
                return(Ok());
            }
            else
            {
                return(Json(result.Errors));
            }
        }