|
|
@ -1,7 +1,9 @@ |
|
|
|
using EPAServeur.Context; |
|
|
|
using EPAServeur.Context; |
|
|
|
using EPAServeur.Exceptions; |
|
|
|
using EPAServeur.Exceptions; |
|
|
|
|
|
|
|
using EPAServeur.IServices; |
|
|
|
using EPAServeur.Models.Formation; |
|
|
|
using EPAServeur.Models.Formation; |
|
|
|
using EPAServeur.Services; |
|
|
|
using EPAServeur.Services; |
|
|
|
|
|
|
|
using IO.Swagger.ApiCollaborateur; |
|
|
|
using IO.Swagger.DTO; |
|
|
|
using IO.Swagger.DTO; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using NUnit.Framework; |
|
|
|
using NUnit.Framework; |
|
|
@ -18,7 +20,8 @@ namespace EPAServeur.Tests.Services |
|
|
|
#region Variables |
|
|
|
#region Variables |
|
|
|
|
|
|
|
|
|
|
|
private EpContext epContext; |
|
|
|
private EpContext epContext; |
|
|
|
|
|
|
|
private ICollaborateurApi collaborateurApi; |
|
|
|
|
|
|
|
private ICollaborateurService collaborateurService; |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
#region Setup |
|
|
|
#region Setup |
|
|
@ -32,7 +35,8 @@ namespace EPAServeur.Tests.Services |
|
|
|
.Options; |
|
|
|
.Options; |
|
|
|
|
|
|
|
|
|
|
|
epContext = new EpContext(optionBuider); |
|
|
|
epContext = new EpContext(optionBuider); |
|
|
|
|
|
|
|
collaborateurApi = new CollaborateurApi(); |
|
|
|
|
|
|
|
collaborateurService = new CollaborateurService(collaborateurApi, epContext); |
|
|
|
epContext.Database.EnsureDeleted(); |
|
|
|
epContext.Database.EnsureDeleted(); |
|
|
|
epContext.Database.EnsureCreated(); |
|
|
|
epContext.Database.EnsureCreated(); |
|
|
|
epContext.SaveChanges(); |
|
|
|
epContext.SaveChanges(); |
|
|
@ -55,7 +59,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationByIdAsync_PasseEnParamUnIdExistantDansLeJeuDeDonneesFictif_RetourneUneFormation() |
|
|
|
public async Task GetFormationByIdAsync_PasseEnParamUnIdExistantDansLeJeuDeDonneesFictif_RetourneUneFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
FormationDTO formationDTO = await formationService.GetFormationByIdAsync(1); |
|
|
|
FormationDTO formationDTO = await formationService.GetFormationByIdAsync(1); |
|
|
@ -82,7 +86,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public void GetFormationByIdAsync_PasseEnParamUnIdInexistantDansLeJeuDeDonneesFictif_LeveUneFormationNotFoundException(long idFormation) |
|
|
|
public void GetFormationByIdAsync_PasseEnParamUnIdInexistantDansLeJeuDeDonneesFictif_LeveUneFormationNotFoundException(long idFormation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
AsyncTestDelegate throwException = () => formationService.GetFormationByIdAsync(idFormation); |
|
|
|
AsyncTestDelegate throwException = () => formationService.GetFormationByIdAsync(idFormation); |
|
|
@ -104,7 +108,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseDesParamsValides_RetourneDesFormations(long? idAgence, int[] arrIdStatuts, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task GetFormationsAsync_PasseDesParamsValides_RetourneDesFormations(long? idAgence, int[] arrIdStatuts, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
List<int?> idStatuts; |
|
|
|
List<int?> idStatuts; |
|
|
|
|
|
|
|
|
|
|
|
if (arrIdStatuts != null) |
|
|
|
if (arrIdStatuts != null) |
|
|
@ -124,7 +128,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaPremierePageDesFormations(int? numPage, int? parPAge) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaPremierePageDesFormations(int? numPage, int? parPAge) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, numPage, parPAge, null, null, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, numPage, parPAge, null, null, null, null); |
|
|
@ -140,7 +144,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaDeuxiemePageDesFormations(int? numPage, int? parPAge) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaDeuxiemePageDesFormations(int? numPage, int? parPAge) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
int? nbFormationDeuxiemePage; |
|
|
|
int? nbFormationDeuxiemePage; |
|
|
|
|
|
|
|
|
|
|
|
switch (parPAge) |
|
|
|
switch (parPAge) |
|
|
@ -171,7 +175,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleCroissant(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleCroissant(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -187,7 +191,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleDecroissant(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleDecroissant(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -202,7 +206,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParStatutCroissant(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParStatutCroissant(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -217,7 +221,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParStatutDecroissant(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParStatutDecroissant(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -232,7 +236,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineCroissante(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineCroissante(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -247,7 +251,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineDecroissante(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineDecroissante(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -262,7 +266,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParDateCroissante(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParDateCroissante(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -277,7 +281,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParDateDecroissante(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParDateDecroissante(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -292,7 +296,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParCertificationCroissante(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParCertificationCroissante(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -307,7 +311,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParCertificationDecroissante(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParCertificationDecroissante(bool? asc, string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
@ -323,7 +327,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebut_RetourneDesFormationsAvecUneDateDeDebutSuperieur(DateTime dateDebut) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebut_RetourneDesFormationsAvecUneDateDeDebutSuperieur(DateTime dateDebut) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, null); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, null); |
|
|
@ -338,7 +342,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeFin_RetourneDesFormationsAvecUneDateDeFinInferieur(DateTime dateFin) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeFin_RetourneDesFormationsAvecUneDateDeFinInferieur(DateTime dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, null, dateFin); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, null, dateFin); |
|
|
@ -353,7 +357,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutEtUneDateDeFin_RetourneDesFormationsAvecUneDateDeDebutSuperieurUneDateDeFinInferieur(DateTime dateDebut, DateTime dateFin) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutEtUneDateDeFin_RetourneDesFormationsAvecUneDateDeDebutSuperieurUneDateDeFinInferieur(DateTime dateDebut, DateTime dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
@ -371,7 +375,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutSuperieurEtUneDateDeFinInferieur_RetourneZeroFormation(DateTime dateDebut, DateTime dateFin) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutSuperieurEtUneDateDeFinInferieur_RetourneZeroFormation(DateTime dateDebut, DateTime dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
|
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
@ -386,7 +390,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsAsync_PasseDesParamsInvalides_RetourneZeroFormation(long? idAgence, int[] arrIdStatuts, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task GetFormationsAsync_PasseDesParamsInvalides_RetourneZeroFormation(long? idAgence, int[] arrIdStatuts, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
List<int?> idStatuts; |
|
|
|
List<int?> idStatuts; |
|
|
|
|
|
|
|
|
|
|
|
if (arrIdStatuts != null) |
|
|
|
if (arrIdStatuts != null) |
|
|
@ -415,7 +419,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsCountAsync_PasseDesParamsValides_RetourneLeNombreTotalDeFormations(long? idAgence, int[] arrIdStatuts, int? numPage, int? parPAge, string texte, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task GetFormationsCountAsync_PasseDesParamsValides_RetourneLeNombreTotalDeFormations(long? idAgence, int[] arrIdStatuts, int? numPage, int? parPAge, string texte, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
List<int?> idStatuts; |
|
|
|
List<int?> idStatuts; |
|
|
|
|
|
|
|
|
|
|
|
if (arrIdStatuts != null) |
|
|
|
if (arrIdStatuts != null) |
|
|
@ -436,7 +440,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetFormationsCountAsync_PasseDesParamsInvalides_RetourneZero(long? idAgence, int[] arrIdStatuts, int? numPage, int? parPAge, string texte, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task GetFormationsCountAsync_PasseDesParamsInvalides_RetourneZero(long? idAgence, int[] arrIdStatuts, int? numPage, int? parPAge, string texte, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
List<int?> idStatuts; |
|
|
|
List<int?> idStatuts; |
|
|
|
|
|
|
|
|
|
|
|
if (arrIdStatuts != null) |
|
|
|
if (arrIdStatuts != null) |
|
|
@ -460,7 +464,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetModesFormationAsync_RetourneTousLesModesDeFormation() |
|
|
|
public async Task GetModesFormationAsync_RetourneTousLesModesDeFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<ModeFormationDTO> modeFormationDTOs = await formationService.GetModesFormationAsync(); |
|
|
|
IEnumerable<ModeFormationDTO> modeFormationDTOs = await formationService.GetModesFormationAsync(); |
|
|
@ -478,7 +482,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetOriginesAsyncFormation_RetourneToutesLesOriginesDeFormation() |
|
|
|
public async Task GetOriginesAsyncFormation_RetourneToutesLesOriginesDeFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<OrigineFormationDTO> origineFormationDTOs = await formationService.GetOriginesFormationAsync(); |
|
|
|
IEnumerable<OrigineFormationDTO> origineFormationDTOs = await formationService.GetOriginesFormationAsync(); |
|
|
@ -496,7 +500,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetStatutsFormationAsyncFormation_RetourneTousLesStatutsDeFormation() |
|
|
|
public async Task GetStatutsFormationAsyncFormation_RetourneTousLesStatutsDeFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<StatutFormationDTO> statutFormationDTOs = await formationService.GetStatutsFormationAsync(); |
|
|
|
IEnumerable<StatutFormationDTO> statutFormationDTOs = await formationService.GetStatutsFormationAsync(); |
|
|
@ -514,7 +518,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task GetTypesFormationAsync_RetourneTousLesTypesDeFormation() |
|
|
|
public async Task GetTypesFormationAsync_RetourneTousLesTypesDeFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
IEnumerable<TypeFormationDTO> typeFormationDTOs = await formationService.GetTypesFormationAsync(); |
|
|
|
IEnumerable<TypeFormationDTO> typeFormationDTOs = await formationService.GetTypesFormationAsync(); |
|
|
@ -559,7 +563,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
EstCertifiee = false |
|
|
|
EstCertifiee = false |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
FormationDTO formationAjoute = await formationService.AddFormationAsync(formation); |
|
|
|
FormationDTO formationAjoute = await formationService.AddFormationAsync(formation); |
|
|
@ -588,7 +592,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationDTO formation = null; |
|
|
|
FormationDTO formation = null; |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation); |
|
|
|
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation); |
|
|
@ -637,7 +641,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
EstCertifiee = false |
|
|
|
EstCertifiee = false |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation); |
|
|
|
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation); |
|
|
@ -683,7 +687,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
EstCertifiee = false |
|
|
|
EstCertifiee = false |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation); |
|
|
|
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation); |
|
|
@ -709,7 +713,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation); |
|
|
|
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation); |
|
|
|
|
|
|
|
|
|
|
@ -773,7 +777,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation); |
|
|
|
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation); |
|
|
|
|
|
|
|
|
|
|
@ -812,7 +816,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
FormationDTO formation = await formationService.GetFormationByIdAsync(1); |
|
|
|
FormationDTO formation = await formationService.GetFormationByIdAsync(1); |
|
|
|
|
|
|
|
|
|
|
@ -850,7 +854,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
FormationDTO formation = new FormationDTO |
|
|
|
FormationDTO formation = new FormationDTO |
|
|
|
{ |
|
|
|
{ |
|
|
@ -886,7 +890,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public async Task DeleteFormationByIdAsync_SupprimeUneFormationAvecUnIdValide_FormationSupprimeAvecSucces(long idFormation) |
|
|
|
public async Task DeleteFormationByIdAsync_SupprimeUneFormationAvecUnIdValide_FormationSupprimeAvecSucces(long idFormation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
bool existFormation = true; |
|
|
|
bool existFormation = true; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
@ -903,7 +907,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
public void DeleteFormationByIdAsync_SupprimeUneFormationAvecUnIdInvalide_LeveUneFormationNotFoundException(long idFormation) |
|
|
|
public void DeleteFormationByIdAsync_SupprimeUneFormationAvecUnIdInvalide_LeveUneFormationNotFoundException(long idFormation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
FormationService formationService = new FormationService(epContext, collaborateurService); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
// Act |
|
|
|
AsyncTestDelegate throwException = () => formationService.DeleteFormationByIdAsync(idFormation); |
|
|
|
AsyncTestDelegate throwException = () => formationService.DeleteFormationByIdAsync(idFormation); |
|
|
|