Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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,
            });
        }
Exemplo n.º 4
0
 public PlanifierUnEntretien(IGenerateur <int> generateur,
                             CreneauDto creneau,
                             CandidatDto candidat,
                             RecruteurDto recruteur,
                             SalleDto salle)
 {
     entretien = new Entretien(generateur.GetNewId(),
                               creneau,
                               EntretienStatut.Planifier,
                               candidat,
                               recruteur,
                               salle);
 }
Exemplo n.º 5
0
 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))
 {
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 public Entretien(CreneauDto creneau, CandidatDto candidat)
 {
     Candidat = new Candidat(candidat);
     Creneau  = new Creneau(creneau);
 }
Exemplo n.º 8
0
 public Creneau(CreneauDto dto)
 {
     StartDate = dto.StartDate;
     EndDate   = dto.EndDate;
 }
Exemplo n.º 9
0
 public void Replanifier(CreneauDto creneau)
 {
     this.creneau = new Creneau(creneau.date, creneau.duree);
     statut       = EntretienStatut.Replanifier;
 }
Exemplo n.º 10
0
 public ReplanifierUnEntretien(IGenerateur <int> generateur, CreneauDto creneau)
 {
     this.id      = generateur.GetNewId();
     this.creneau = creneau;
 }