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 SalleAggregate Match(IEnumerable <SalleDto> salles, CreneauDto creneau) { var c = new Creneau(creneau); Salle = salles.Select(s => new Salle(s)) .FirstOrDefault(salle => salle.IsAvailableAt(c)); return(this); }
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 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 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 Creneau(CreneauDto dto) { StartDate = dto.StartDate; EndDate = dto.EndDate; }
public void Replanifier(CreneauDto creneau) { this.creneau = new Creneau(creneau.date, creneau.duree); statut = EntretienStatut.Replanifier; }
public ReplanifierUnEntretien(IGenerateur <int> generateur, CreneauDto creneau) { this.id = generateur.GetNewId(); this.creneau = creneau; }