public void Setup() { CreneauDto creneau = new CreneauDto { date = new DateTime(2019, 10, 9, 10, 00, 00), duree = TimeSpan.FromHours(2) }; CandidatDto candidat = new CandidatDto { experience = TimeSpan.FromDays(500), name = "Willy", specialite = Specialite.csharp }; RecruteurDto recruteur = new RecruteurDto { experience = TimeSpan.FromDays(5000), name = "Yohan", specialite = Specialite.csharp }; SalleDto salle = new SalleDto { name = "kilimanjaro", statut = SalleStatut.Libre }; genMock = new Mock <IGenerateur <int> >(); genMock.Setup(gen => gen.GetNewId()).Returns(1); planifierUnEntretien = new PlanifierUnEntretien(genMock.Object, creneau, candidat, recruteur, salle); }
public RendezVousDto PlanifierUnEntretien(CreneauDto creneau, CandidatDto candidat) { var availableConsultantRecruteur = _consultantRecruteurRepository.GetAvailableConsultantRecruteurForDate(creneau.StartDate); var salles = _salleRepository.Get(creneau.StartDate); var entretien = new Entretien(creneau, candidat) .Schedule(availableConsultantRecruteur); return(new RendezVousDto { Salle = (SalleDto) new SalleAggregate().Match(salles, creneau).Salle, Entretien = (EntretienDto)entretien, }); }
public PlanifierUnEntretien(IGenerateur <int> generateur, CreneauDto creneau, CandidatDto candidat, RecruteurDto recruteur, SalleDto salle) { entretien = new Entretien(generateur.GetNewId(), creneau, EntretienStatut.Planifier, candidat, recruteur, salle); }
public IActionResult Put([FromBody] CandidatDto value) { var res = this.CandidatService.AddCandidat(value); if (res) { return(Ok()); } else { return(StatusCode(500)); } }
public Entretien(int id, CreneauDto creneau, EntretienStatut statut, CandidatDto candidat, RecruteurDto recruteur, SalleDto salle) : this(id, new Creneau(creneau.date, creneau.duree), statut, new Candidat(candidat.name, candidat.specialite, candidat.experience), new Recruteur(recruteur.name, recruteur.specialite, recruteur.experience), new Salle(salle.name, salle.statut)) { }
public bool AddCandidat(CandidatDto dto) { var model = GetModel(dto); var candidatId = this._candidatRepositories.AddCandidat(model); var answer = true; // var tests = GetTests(model.Position.Id); // var tests = _testService.GetTests(model.PositionId); answer = this._answerService.AddAnswerByCandidat(candidatId, model.PositionId); return(answer); }
private Candidat GetModel(CandidatDto candidatDto) { var candidatModel = new Candidat { Name = candidatDto.Name, Email = candidatDto.Email, ExpiredDate = candidatDto.ExpiredDate, InvitationDate = candidatDto.InvitationDate, Number = candidatDto.Number, Phone = candidatDto.Phone, }; candidatModel.Position = this._positionRepository.GetPositionWithoutIncludes(candidatDto.PositionId); return(candidatModel); }
private CandidatDto GetDto(Candidat candidatModel) { var candidatDto = new CandidatDto() { Id = candidatModel.Id, Name = candidatModel.Name, Email = candidatModel.Email, ExpiredDate = candidatModel.ExpiredDate, InvitationDate = candidatModel.InvitationDate, Number = candidatModel.Number, PositionId = candidatModel.PositionId, Answers = new List <AnswerDto>() }; foreach (var item in candidatModel.Answers) { candidatDto.Answers.Add(GetDto(item)); } return(candidatDto); }
private PositionDto GetDto(Position positionModel) { var positionDto = new PositionDto() { Id = positionModel.Id, Status = positionModel.Status, CloseDate = positionModel.CloseDate, Name = positionModel.Name, About = positionModel.About, CompanyInfo = positionModel.CompanyInfo, Number = positionModel.Number, Instruction = positionModel.Instruction, AvailableTime = positionModel.AvailableTime, OpenDate = positionModel.OpenDate, Viewers = new List <ViewerDto>(), Candidats = new List <CandidatDto>(), Tests = new List <TestDto>() }; if (positionModel.Candidats != null) { foreach (var candidatModel in positionModel.Candidats) { var candidatDto = new CandidatDto() { Id = candidatModel.Id, Name = candidatModel.Name, Email = candidatModel.Email, ExpiredDate = candidatModel.ExpiredDate, InvitationDate = candidatModel.InvitationDate, Number = candidatModel.Number, Phone = candidatModel.Phone, PositionId = positionDto.Id, Answers = new List <AnswerDto>() }; foreach (var answerModel in candidatModel.Answers) { var answerDto = new AnswerDto() { Id = answerModel.Id, CandidatId = candidatModel.Id, Content = answerModel.Content, Reference = answerModel.Reference, TestId = answerModel.TestId, Ratings = new List <RatingDto>() }; foreach (var ratingModel in answerModel.Rating) { var ratingDto = new RatingDto() { AnswerId = answerModel.Id, Grade = ratingModel.Grade, Id = ratingModel.Id, Number = ratingModel.Number, ViewerId = ratingModel.ViewerId }; answerDto.Ratings.Add(ratingDto); } candidatDto.Answers.Add(answerDto); } positionDto.Candidats.Add(candidatDto); } } if (positionModel.Tests != null) { foreach (var testModel in positionModel.Tests) { var testDto = new TestDto() { Id = testModel.Id, Name = testModel.Name, Number = testModel.Number, Time = testModel.Time, PositionId = testModel.Position.Id, Answers = new List <AnswerDto>(), }; positionDto.Tests.Add(testDto); } } if (positionModel.Viewers == null) { return(positionDto); } foreach (var viewerModel in positionModel.Viewers) { var viewertDto = new ViewerDto() { Id = viewerModel.Id, Name = viewerModel.Name, Email = viewerModel.Email, Number = viewerModel.Number, InvitationDate = viewerModel.InvitationDate, }; positionDto.Viewers.Add(viewertDto); } return(positionDto); }
public void ShouldGiveMeAllAvailableConsultantRecruteurForDate() { var now = DateTimeOffset.UtcNow; //ARRANGE var consultantRecruteurRepository = new Mock <IConsultantRecruteurRepository>(); var salleRepository = new Mock <ISalleRepository>(); var consultantRecruteurs = new [] { new ConsultantRecruteurDto { Name = "Alain", Profile = new ProfileDto { Experience = 2 }, }, new ConsultantRecruteurDto { Name = "Remi", Profile = new ProfileDto { Experience = 7 }, } }; consultantRecruteurRepository.Setup(x => x.GetAvailableConsultantRecruteurForDate(It.IsAny <DateTimeOffset>())) .Returns(consultantRecruteurs); var salles = new [] { new SalleDto { Name = "salle", }, }; salleRepository.Setup(r => r.Get(It.IsAny <DateTimeOffset>())) .Returns(salles); var candidat = new CandidatDto { Name = "Max", Profile = new ProfileDto { Experience = 2 }, }; var creneau = new CreneauDto { StartDate = now, EndDate = now.AddHours(1), }; //ACT var planifierEntretien = new PlanifierEntretien(consultantRecruteurRepository.Object, salleRepository.Object); var result = planifierEntretien.PlanifierUnEntretien(creneau, candidat); var expected = new RendezVousDto { Salle = salles[0], Entretien = new EntretienDto { Creneau = creneau, Candidat = candidat, ConsultantRecruteur = consultantRecruteurs[1], Status = EntretienStatusDto.Scheduled, }, }; //ASSERT result.Should().BeEquivalentTo(expected); }
public Entretien(CreneauDto creneau, CandidatDto candidat) { Candidat = new Candidat(candidat); Creneau = new Creneau(creneau); }
public bool UpdateCandidat(CandidatDto dto) { throw new NotImplementedException(); }
private PositionDto GetDto(Position positionModel) { var positionDto = new PositionDto() { Id = positionModel.Id, Status = positionModel.Status, CloseDate = positionModel.CloseDate, Name = positionModel.Name, About = positionModel.About, CompanyInfo = positionModel.CompanyInfo, Number = positionModel.Number, Instruction = positionModel.Instruction, AvailableTime = positionModel.AvailableTime, OpenDate = positionModel.OpenDate, Viewers = new List <ViewerDto>(), Candidats = new List <CandidatDto>(), Tests = new List <TestDto>() }; if (positionModel.Candidats != null) { foreach (var candidatModel in positionModel.Candidats) { var candidatDto = new CandidatDto() { Id = candidatModel.Id, Name = candidatModel.Name, Email = candidatModel.Email, ExpiredDate = candidatModel.ExpiredDate, InvitationDate = candidatModel.InvitationDate, Number = candidatModel.Number, Phone = candidatModel.Phone, PositionId = positionDto.Id, }; positionDto.Candidats.Add(candidatDto); } } if (positionModel.Tests != null) { foreach (var testModel in positionModel.Tests) { var testDto = new TestDto() { Id = testModel.Id, Name = testModel.Name, Number = testModel.Number, Time = testModel.Time, PositionId = testModel.Position.Id, Answers = new List <AnswerDto>(), }; positionDto.Tests.Add(testDto); } } if (positionModel.Viewers == null) { return(positionDto); } foreach (var viewerModel in positionModel.Viewers) { var viewertDto = new ViewerDto() { Id = viewerModel.Id, Name = viewerModel.Name, Email = viewerModel.Email, Number = viewerModel.Number, InvitationDate = viewerModel.InvitationDate, }; positionDto.Viewers.Add(viewertDto); } return(positionDto); }
public Candidat(CandidatDto dto) { Name = dto.Name; Profile = new Profile(dto.Profile); }
public void Post([FromBody] CandidatDto dto) { this.CandidatService.AddCandidat(dto); }