|
|
@ -62,10 +62,10 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
// Assert |
|
|
|
Assert.AreEqual(1, formationDTO.Id); |
|
|
|
Assert.AreEqual(1, formationDTO.Id); |
|
|
|
Assert.AreEqual("Formation1", formationDTO.Intitule); |
|
|
|
Assert.AreEqual("Formation Mainframe Complète", formationDTO.Intitule); |
|
|
|
Assert.AreEqual(1, formationDTO.IdAgence); |
|
|
|
Assert.AreEqual(1, formationDTO.IdAgence); |
|
|
|
Assert.AreEqual(new DateTime(2020, 9, 16, 10, 0, 0), formationDTO.DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 1, 25, 10, 0, 0), formationDTO.DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 9, 17), formationDTO.DateFin); |
|
|
|
Assert.AreEqual(new DateTime(2020, 1, 27), formationDTO.DateFin); |
|
|
|
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); |
|
|
@ -96,11 +96,11 @@ namespace EPAServeur.Tests.Services |
|
|
|
#region Tests GetFormationsAsync |
|
|
|
#region Tests GetFormationsAsync |
|
|
|
|
|
|
|
|
|
|
|
[TestCase(1, new int[] { 1, 2, 3 }, true, 1, 5, "formation", null, null, null)] |
|
|
|
[TestCase(1, new int[] { 1, 2, 3 }, true, 1, 5, "formation", null, null, null)] |
|
|
|
[TestCase(1, new int[] { 1 }, false, 1, 5, "formation1", null, null, null)] |
|
|
|
[TestCase(1, new int[] { 1 }, false, 1, 5, "Formation Mainframe Complète", null, null, null)] |
|
|
|
[TestCase(null, null, null, 2, 10, null, null, null, null)] |
|
|
|
[TestCase(null, null, null, 2, 10, null, null, null, null)] |
|
|
|
[TestCase(null, new int[] { 1 }, null, 1, 10, null, null, null, null)] |
|
|
|
[TestCase(null, new int[] { 1 }, null, 1, 10, null, null, null, null)] |
|
|
|
[TestCase(1, null, null, 1, 10, "for", null, null, null)] |
|
|
|
[TestCase(1, null, null, 1, 10, "for", null, null, null)] |
|
|
|
[TestCase(1, new int[] { }, null, 1, 10, "for", null, null, null)] |
|
|
|
[TestCase(1, new int[] { }, null, 1, 10, "for", null, null, null)] |
|
|
|
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 |
|
|
@ -119,6 +119,53 @@ namespace EPAServeur.Tests.Services |
|
|
|
Assert.Less(0, formationDTOs.Count()); |
|
|
|
Assert.Less(0, formationDTOs.Count()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase(1, 5)] |
|
|
|
|
|
|
|
[TestCase(1, 10)] |
|
|
|
|
|
|
|
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaPremierePageDesFormations(int? numPage, int? parPAge) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, numPage, parPAge, null, null, null, null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
|
|
Assert.AreEqual(parPAge, formationDTOs.Count()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase(2, 5)] |
|
|
|
|
|
|
|
[TestCase(2, 6)] |
|
|
|
|
|
|
|
[TestCase(2, 10)] |
|
|
|
|
|
|
|
[TestCase(2, 15)] |
|
|
|
|
|
|
|
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaDeuxiemePageDesFormations(int? numPage, int? parPAge) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
|
|
FormationService formationService = new FormationService(epContext); |
|
|
|
|
|
|
|
int? nbFormationDeuxiemePage; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (parPAge) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
nbFormationDeuxiemePage = 5; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 6: |
|
|
|
|
|
|
|
nbFormationDeuxiemePage = 5; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 10: |
|
|
|
|
|
|
|
nbFormationDeuxiemePage = 1; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
nbFormationDeuxiemePage = 0; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, numPage, parPAge, null, null, null, null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
|
|
Assert.AreEqual(nbFormationDeuxiemePage, formationDTOs.Count()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[TestCase(true, "intitule")] |
|
|
|
[TestCase(true, "intitule")] |
|
|
|
[TestCase(true, null)] |
|
|
|
[TestCase(true, null)] |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleCroissant(bool? asc, string tri) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleCroissant(bool? asc, string tri) |
|
|
@ -130,8 +177,8 @@ namespace EPAServeur.Tests.Services |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
// Assert |
|
|
|
Assert.AreEqual("Formation1", formationDTOs.First().Intitule); |
|
|
|
Assert.AreEqual("Apprendre C# et le développement de logiciels avec WPF", formationDTOs.First().Intitule); |
|
|
|
Assert.AreEqual("Formation9", formationDTOs.Last().Intitule); |
|
|
|
Assert.AreEqual("Formation Xamarin, Développer des applications mobiles en C# pour iOS et Android", formationDTOs.Last().Intitule); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -146,8 +193,8 @@ namespace EPAServeur.Tests.Services |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
// Assert |
|
|
|
Assert.AreEqual("Formation9", formationDTOs.First().Intitule); |
|
|
|
Assert.AreEqual("Formation Xamarin, Développer des applications mobiles en C# pour iOS et Android", formationDTOs.First().Intitule); |
|
|
|
Assert.AreEqual("Formation1", formationDTOs.Last().Intitule); |
|
|
|
Assert.AreEqual("Apprendre C# et le développement de logiciels avec WPF", formationDTOs.Last().Intitule); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -221,8 +268,8 @@ namespace EPAServeur.Tests.Services |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
// Assert |
|
|
|
Assert.AreEqual(new DateTime(2020, 04, 6, 9, 0, 0), formationDTOs.First().DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 1, 25, 10, 0, 0), formationDTOs.First().DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 11, 18, 10, 0, 0), formationDTOs.Last().DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 12, 25, 14, 0, 0), formationDTOs.Last().DateDebut); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -236,8 +283,8 @@ namespace EPAServeur.Tests.Services |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
IEnumerable<FormationDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
// Assert |
|
|
|
Assert.AreEqual(new DateTime(2020, 11, 18, 10, 0, 0), formationDTOs.First().DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 12, 25, 14, 0, 0), formationDTOs.First().DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 04, 6, 9, 0, 0), formationDTOs.Last().DateDebut); |
|
|
|
Assert.AreEqual(new DateTime(2020, 1, 25, 10, 0, 0), formationDTOs.Last().DateDebut); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -302,7 +349,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[TestCase("2020-10-01", "2020-11-01")] |
|
|
|
[TestCase("2020-11-01", "2020-12-01")] |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutEtUneDateDeFin_RetourneDesFormationsAvecUneDateDeDebutSuperieurUneDateDeFinInferieur(DateTime dateDebut, DateTime dateFin) |
|
|
|
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutEtUneDateDeFin_RetourneDesFormationsAvecUneDateDeDebutSuperieurUneDateDeFinInferieur(DateTime dateDebut, DateTime dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Arrange |
|
|
|
// Arrange |
|
|
@ -360,7 +407,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
#region Tests GetFormationsCountAsync |
|
|
|
#region Tests GetFormationsCountAsync |
|
|
|
|
|
|
|
|
|
|
|
[TestCase(1, new int[] { 1, 2, 3 }, 1, 5, "formation", "2020-09-30", "2020-11-30")] |
|
|
|
[TestCase(1, new int[] { 1, 2, 3 }, 1, 5, "formation", "2020-09-30", "2020-11-30")] |
|
|
|
[TestCase(1, new int[] { 1 }, 1, 5, "formation1", null, null)] |
|
|
|
[TestCase(1, new int[] { 1 }, 1, 5, "Formation Mainframe Complète", null, null)] |
|
|
|
[TestCase(null, null, 2, 10, null, null, null)] |
|
|
|
[TestCase(null, null, 2, 10, null, null, null)] |
|
|
|
[TestCase(null, new int[] { 1 }, 1, 10, null, null, null)] |
|
|
|
[TestCase(null, new int[] { 1 }, 1, 10, null, null, null)] |
|
|
|
[TestCase(1, null, 1, 10, "for", null, null)] |
|
|
|
[TestCase(1, null, 1, 10, "for", null, null)] |
|
|
|