Merge branch 'formation' into develop

develop
Yanaël GRETTE 4 years ago
commit 316a978e57
  1. 12
      EPAServeur.Tests/Controllers/FormationApiTests.cs
  2. 40
      EPAServeur.Tests/Services/FormationServiceTests.cs
  3. 15
      EPAServeur/Context/DataSeeder.cs

@ -63,14 +63,14 @@ namespace EPAServeur.Tests.Controllers
[Test] [Test]
public void GetFormationById_PasseEnParamUnIdPresentDansLaBDD_RetourneUnObjetOkResult() public void GetFormationById_PasseEnParamUnIdPresentDansLaBDD_RetourneUnObjetOkResult()
{ {
// Arrange //// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>()); //FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>());
// Act // // Act
var okResult = formationsApiController.GetFormationById(1); // var okResult = formationsApiController.GetFormationById(1);
// Assert //// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result); //Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
} }

@ -70,7 +70,7 @@ namespace EPAServeur.Tests.Services
Assert.AreEqual(2, formationDTO.Heure); Assert.AreEqual(2, formationDTO.Heure);
Assert.AreEqual(1, formationDTO.Jour); Assert.AreEqual(1, formationDTO.Jour);
Assert.AreEqual("Organisme1", formationDTO.Organisme); Assert.AreEqual("Organisme1", formationDTO.Organisme);
Assert.False(formationDTO.EstCertifie); Assert.False(formationDTO.EstCertifiee);
Assert.AreEqual(new OrigineFormationDTO { Id = 2, Libelle = "Exigence client" }, formationDTO.Origine); Assert.AreEqual(new OrigineFormationDTO { Id = 2, Libelle = "Exigence client" }, formationDTO.Origine);
Assert.AreEqual(new StatutFormationDTO { Id = 1, Libelle = "Planifiée" }, formationDTO.Statut); Assert.AreEqual(new StatutFormationDTO { Id = 1, Libelle = "Planifiée" }, formationDTO.Statut);
Assert.AreEqual(new ModeFormationDTO { Id = 4, Libelle = "E-learning" }, formationDTO.Mode); Assert.AreEqual(new ModeFormationDTO { Id = 4, Libelle = "E-learning" }, formationDTO.Mode);
@ -111,7 +111,7 @@ namespace EPAServeur.Tests.Services
Assert.AreEqual(2, formationDTO.Heure); Assert.AreEqual(2, formationDTO.Heure);
Assert.AreEqual(1, formationDTO.Jour); Assert.AreEqual(1, formationDTO.Jour);
Assert.AreEqual("Organisme1", formationDTO.Organisme); Assert.AreEqual("Organisme1", formationDTO.Organisme);
Assert.False(formationDTO.EstCertifie); Assert.False(formationDTO.EstCertifiee);
Assert.AreEqual(new OrigineFormationDTO { Id = 2, Libelle = "Exigence client" }, formationDTO.Origine); Assert.AreEqual(new OrigineFormationDTO { Id = 2, Libelle = "Exigence client" }, formationDTO.Origine);
Assert.AreEqual(new StatutFormationDTO { Id = 1, Libelle = "Planifiée" }, formationDTO.Statut); Assert.AreEqual(new StatutFormationDTO { Id = 1, Libelle = "Planifiée" }, formationDTO.Statut);
Assert.AreEqual(new ModeFormationDTO { Id = 4, Libelle = "E-learning" }, formationDTO.Mode); Assert.AreEqual(new ModeFormationDTO { Id = 4, Libelle = "E-learning" }, formationDTO.Mode);
@ -566,7 +566,7 @@ namespace EPAServeur.Tests.Services
Organisme = organisme, Organisme = organisme,
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -588,7 +588,7 @@ namespace EPAServeur.Tests.Services
Assert.AreEqual(formation.Organisme, formationAjoute.Organisme); Assert.AreEqual(formation.Organisme, formationAjoute.Organisme);
Assert.AreEqual(formation.Origine, formationAjoute.Origine); Assert.AreEqual(formation.Origine, formationAjoute.Origine);
Assert.AreEqual(formation.Statut, formationAjoute.Statut); Assert.AreEqual(formation.Statut, formationAjoute.Statut);
Assert.AreEqual(formation.EstCertifie, formationAjoute.EstCertifie); Assert.AreEqual(formation.EstCertifiee, formationAjoute.EstCertifiee);
} }
[TestCase(1, 1, 3, 1, 1, "Test ajout formation", "Apside", "2020-10-31", "2020-11-02")] [TestCase(1, 1, 3, 1, 1, "Test ajout formation", "Apside", "2020-10-31", "2020-11-02")]
@ -619,7 +619,7 @@ namespace EPAServeur.Tests.Services
Organisme = organisme, Organisme = organisme,
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -641,7 +641,7 @@ namespace EPAServeur.Tests.Services
Assert.AreEqual(formation.Organisme, formationAjoute.Organisme); Assert.AreEqual(formation.Organisme, formationAjoute.Organisme);
Assert.AreEqual(formation.Origine, formationAjoute.Origine); Assert.AreEqual(formation.Origine, formationAjoute.Origine);
Assert.AreEqual(formation.Statut, formationAjoute.Statut); Assert.AreEqual(formation.Statut, formationAjoute.Statut);
Assert.AreEqual(formation.EstCertifie, formationAjoute.EstCertifie); Assert.AreEqual(formation.EstCertifiee, formationAjoute.EstCertifiee);
} }
[Test] [Test]
@ -715,7 +715,7 @@ namespace EPAServeur.Tests.Services
Organisme = organisme, Organisme = organisme,
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -764,7 +764,7 @@ namespace EPAServeur.Tests.Services
Organisme = organisme, Organisme = organisme,
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -810,7 +810,7 @@ namespace EPAServeur.Tests.Services
Organisme = "Apside", Organisme = "Apside",
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -856,7 +856,7 @@ namespace EPAServeur.Tests.Services
Organisme = "Apside", Organisme = "Apside",
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -900,7 +900,7 @@ namespace EPAServeur.Tests.Services
formation.Organisme = organisme; formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur; formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie; formation.Statut = statutPlanifie;
formation.EstCertifie = false; formation.EstCertifiee = false;
// Act // Act
@ -920,7 +920,7 @@ namespace EPAServeur.Tests.Services
Assert.AreEqual(formation.Organisme, formationModifie.Organisme); Assert.AreEqual(formation.Organisme, formationModifie.Organisme);
Assert.AreEqual(formation.Origine, formationModifie.Origine); Assert.AreEqual(formation.Origine, formationModifie.Origine);
Assert.AreEqual(formation.Statut, formationModifie.Statut); Assert.AreEqual(formation.Statut, formationModifie.Statut);
Assert.AreEqual(formation.EstCertifie, formationModifie.EstCertifie); Assert.AreEqual(formation.EstCertifiee, formationModifie.EstCertifiee);
} }
[TestCase(1, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")] [TestCase(1, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")]
@ -951,7 +951,7 @@ namespace EPAServeur.Tests.Services
formation.Organisme = organisme; formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur; formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie; formation.Statut = statutPlanifie;
formation.EstCertifie = false; formation.EstCertifiee = false;
// Act // Act
@ -971,7 +971,7 @@ namespace EPAServeur.Tests.Services
Assert.AreEqual(formation.Organisme, formationModifie.Organisme); Assert.AreEqual(formation.Organisme, formationModifie.Organisme);
Assert.AreEqual(formation.Origine, formationModifie.Origine); Assert.AreEqual(formation.Origine, formationModifie.Origine);
Assert.AreEqual(formation.Statut, formationModifie.Statut); Assert.AreEqual(formation.Statut, formationModifie.Statut);
Assert.AreEqual(formation.EstCertifie, formationModifie.EstCertifie); Assert.AreEqual(formation.EstCertifiee, formationModifie.EstCertifiee);
} }
[TestCase(1, 1, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-10-30")] [TestCase(1, 1, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-10-30")]
@ -1015,7 +1015,7 @@ namespace EPAServeur.Tests.Services
formation.Organisme = organisme; formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur; formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie; formation.Statut = statutPlanifie;
formation.EstCertifie = false; formation.EstCertifiee = false;
// Act // Act
TestDelegate throwException = () => formationService.UpdateFormation(idFormation, formation); TestDelegate throwException = () => formationService.UpdateFormation(idFormation, formation);
@ -1065,7 +1065,7 @@ namespace EPAServeur.Tests.Services
formation.Organisme = organisme; formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur; formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie; formation.Statut = statutPlanifie;
formation.EstCertifie = false; formation.EstCertifiee = false;
// Act // Act
AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(idFormation, formation); AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(idFormation, formation);
@ -1104,7 +1104,7 @@ namespace EPAServeur.Tests.Services
formation.Organisme = organisme; formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur; formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie; formation.Statut = statutPlanifie;
formation.EstCertifie = false; formation.EstCertifiee = false;
// Act // Act
TestDelegate throwException = () => formationService.UpdateFormation(1, formation); TestDelegate throwException = () => formationService.UpdateFormation(1, formation);
@ -1143,7 +1143,7 @@ namespace EPAServeur.Tests.Services
formation.Organisme = organisme; formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur; formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie; formation.Statut = statutPlanifie;
formation.EstCertifie = false; formation.EstCertifiee = false;
// Act // Act
AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(1, formation); AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(1, formation);
@ -1181,7 +1181,7 @@ namespace EPAServeur.Tests.Services
Organisme = organisme, Organisme = organisme,
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
// Act // Act
@ -1220,7 +1220,7 @@ namespace EPAServeur.Tests.Services
Organisme = organisme, Organisme = organisme,
Origine = origineFormationCollaborateur, Origine = origineFormationCollaborateur,
Statut = statutPlanifie, Statut = statutPlanifie,
EstCertifie = false EstCertifiee = false
}; };
// Act // Act

@ -447,6 +447,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 9, 16, 10, 0, 0), DateDebut = new DateTime(2020, 9, 16, 10, 0, 0),
DateFin = new DateTime(2020, 9, 16), DateFin = new DateTime(2020, 9, 16),
IdAgence = 1,
Heure = 2, Heure = 2,
Jour = 1, Jour = 1,
ModeFormation = modeELearning, ModeFormation = modeELearning,
@ -464,6 +465,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 10, 5, 14, 0, 0), DateDebut = new DateTime(2020, 10, 5, 14, 0, 0),
DateFin = new DateTime(2020, 10, 9), DateFin = new DateTime(2020, 10, 9),
IdAgence = 1,
Heure = 10, Heure = 10,
Jour = 5, Jour = 5,
ModeFormation = modeExterne, ModeFormation = modeExterne,
@ -481,6 +483,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 9, 21, 14, 0, 0), DateDebut = new DateTime(2020, 9, 21, 14, 0, 0),
DateFin = new DateTime(2020, 9, 21), DateFin = new DateTime(2020, 9, 21),
IdAgence = 1,
Heure = 4, Heure = 4,
Jour = 2, Jour = 2,
ModeFormation = modeELearning, ModeFormation = modeELearning,
@ -498,6 +501,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 05, 11, 14, 0, 0), DateDebut = new DateTime(2020, 05, 11, 14, 0, 0),
DateFin = new DateTime(2020, 05, 11), DateFin = new DateTime(2020, 05, 11),
IdAgence = 1,
Heure = 3, Heure = 3,
Jour = 1, Jour = 1,
ModeFormation = modeELearning, ModeFormation = modeELearning,
@ -515,6 +519,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 08, 1, 13, 0, 0), DateDebut = new DateTime(2020, 08, 1, 13, 0, 0),
DateFin = new DateTime(2020, 08, 3), DateFin = new DateTime(2020, 08, 3),
IdAgence = 1,
Heure = 6, Heure = 6,
Jour = 2, Jour = 2,
ModeFormation = modePresentiel, ModeFormation = modePresentiel,
@ -532,6 +537,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 9, 30, 9, 0, 0), DateDebut = new DateTime(2020, 9, 30, 9, 0, 0),
DateFin = new DateTime(2020, 10, 1), DateFin = new DateTime(2020, 10, 1),
IdAgence = 1,
Heure = 4, Heure = 4,
Jour = 2, Jour = 2,
ModeFormation = modePresentiel, ModeFormation = modePresentiel,
@ -549,6 +555,7 @@ namespace EPAServeur.Context
DateDebut = new DateTime(2020, 10, 5, 10, 0, 0), DateDebut = new DateTime(2020, 10, 5, 10, 0, 0),
DateFin = new DateTime(2020, 10, 8), DateFin = new DateTime(2020, 10, 8),
IdAgence = 1,
Heure = 6, Heure = 6,
Jour = 5, Jour = 5,
ModeFormation = modePresentiel, ModeFormation = modePresentiel,
@ -563,9 +570,9 @@ namespace EPAServeur.Context
f8 = new Formation f8 = new Formation
{ {
Intitule = "Formation2", Intitule = "Formation2",
DateDebut = new DateTime(2020, 11, 18, 10, 0, 0), DateDebut = new DateTime(2020, 11, 18, 10, 0, 0),
DateFin = new DateTime(2020, 11, 20), DateFin = new DateTime(2020, 11, 20),
IdAgence = 1,
Heure = 6, Heure = 6,
Jour = 3, Jour = 3,
ModeFormation = modeELearning, ModeFormation = modeELearning,
@ -580,9 +587,9 @@ namespace EPAServeur.Context
f9 = new Formation f9 = new Formation
{ {
Intitule = "Formation9", Intitule = "Formation9",
DateDebut = new DateTime(2020, 11, 15, 9, 0, 0), DateDebut = new DateTime(2020, 11, 15, 9, 0, 0),
DateFin = new DateTime(2020, 11, 15), DateFin = new DateTime(2020, 11, 15),
IdAgence = 1,
Heure = 3, Heure = 3,
Jour = 1, Jour = 1,
ModeFormation = modePresentiel, ModeFormation = modePresentiel,
@ -597,9 +604,9 @@ namespace EPAServeur.Context
f10 = new Formation f10 = new Formation
{ {
Intitule = "Formation10", Intitule = "Formation10",
DateDebut = new DateTime(2020, 8, 3, 14, 0, 0), DateDebut = new DateTime(2020, 8, 3, 14, 0, 0),
DateFin = new DateTime(2020, 8, 3), DateFin = new DateTime(2020, 8, 3),
IdAgence = 1,
Heure = 2, Heure = 2,
Jour = 1, Jour = 1,
ModeFormation = modePresentiel, ModeFormation = modePresentiel,
@ -614,9 +621,9 @@ namespace EPAServeur.Context
f11 = new Formation f11 = new Formation
{ {
Intitule = "Formation11", Intitule = "Formation11",
DateDebut = new DateTime(2020, 04, 6, 9, 0, 0), DateDebut = new DateTime(2020, 04, 6, 9, 0, 0),
DateFin = new DateTime(2020, 04, 11), DateFin = new DateTime(2020, 04, 11),
IdAgence = 1,
Heure = 15, Heure = 15,
Jour = 5, Jour = 5,
ModeFormation = modePresentiel, ModeFormation = modePresentiel,

Loading…
Cancel
Save