|
|
|
@ -61,18 +61,19 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
|
|
|
|
|
#region Tests GetDemandesFormationAsync |
|
|
|
|
|
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.EnAttente, EtatDemande.Validee, EtatDemande.Rejetee }, new long[] { 1, 2 }, true, 1, 20, "gaillard", null, null, null)] |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.EnAttente, EtatDemande.Validee, EtatDemande.Rejetee }, new long[] { 1 }, false, 1, 5, "gaillard", null, null, null)] |
|
|
|
|
[TestCase(null, null, null, 2, 5, null, null, null, null)] |
|
|
|
|
[TestCase(null, new long[] { 1 }, null, 1, 10, null, null, null, null)] |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.Rejetee }, null, null, 1, 10, "gai", null, null, null)] |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.EnAttente, EtatDemande.Validee, EtatDemande.Rejetee }, new long[] { }, null, 1, 50, "gai", null, null, null)] |
|
|
|
|
public async Task GetDemandesFormationAsync_PasseDesParamsValides_RetourneDesDemandesDeFormations(EtatDemande[] arrEtatDemandes, long[] arrIdBUs, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.EnAttente, EtatDemande.Validee, EtatDemande.Rejetee }, new long[] { 1, 2 }, new StatutEp[] { StatutEp.Signe, StatutEp.SignatureReferent }, true, 1, 20, "gaillard", null, null, null)] |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.EnAttente, EtatDemande.Validee, EtatDemande.Rejetee }, new long[] { 1 }, new StatutEp[] { StatutEp.Signe, StatutEp.SignatureReferent }, false, 1, 5, "gaillard", null, null, null)] |
|
|
|
|
[TestCase(null, null, null, null, 2, 5, null, null, null, null)] |
|
|
|
|
[TestCase(null, new long[] { 1 }, null, null, 1, 10, null, null, null, null)] |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.Rejetee }, null, null, null, 1, 10, "gai", null, null, null)] |
|
|
|
|
[TestCase(new EtatDemande[] { EtatDemande.EnAttente, EtatDemande.Validee, EtatDemande.Rejetee }, new long[] { }, new StatutEp[] { StatutEp.Signe, StatutEp.SignatureReferent }, null, 1, 50, "gai", null, null, null)] |
|
|
|
|
public async Task GetDemandesFormationAsync_PasseDesParamsValides_RetourneDesDemandesDeFormations(EtatDemande[] arrEtatDemandes, long[] arrIdBUs, StatutEp[] arrStatutsEp, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
|
{ |
|
|
|
|
// Arrange |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
List<long?> idBUs; |
|
|
|
|
List<EtatDemande> etatDemandes; |
|
|
|
|
List<StatutEp> statutsEp; |
|
|
|
|
|
|
|
|
|
if (arrEtatDemandes != null) |
|
|
|
|
etatDemandes = arrEtatDemandes.ToList(); |
|
|
|
@ -84,8 +85,13 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
else |
|
|
|
|
idBUs = null; |
|
|
|
|
|
|
|
|
|
if (arrStatutsEp != null) |
|
|
|
|
statutsEp = arrStatutsEp.ToList(); |
|
|
|
|
else |
|
|
|
|
statutsEp = null; |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(etatDemandes, idBUs, asc, numPage, parPAge, texte, tri, dateDebut, dateFin); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(etatDemandes, idBUs, statutsEp, asc, numPage, parPAge, texte, tri, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.Less(0, demandeFormationDTOs.Count()); |
|
|
|
@ -99,7 +105,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, numPage, parPage, null, null, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, numPage, parPage, null, null, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(parPage, demandeFormationDTOs.Count()); |
|
|
|
@ -121,10 +127,10 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
nbDemandeFormationDeuxiemePage = 5; |
|
|
|
|
break; |
|
|
|
|
case 6: |
|
|
|
|
nbDemandeFormationDeuxiemePage = 4; |
|
|
|
|
nbDemandeFormationDeuxiemePage = 6; |
|
|
|
|
break; |
|
|
|
|
case 10: |
|
|
|
|
nbDemandeFormationDeuxiemePage = 0; |
|
|
|
|
nbDemandeFormationDeuxiemePage = 2; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
nbDemandeFormationDeuxiemePage = 0; |
|
|
|
@ -132,7 +138,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, numPage, parPage, null, null, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, numPage, parPage, null, null, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(nbDemandeFormationDeuxiemePage, demandeFormationDTOs.Count()); |
|
|
|
@ -145,7 +151,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual("Orléans", demandeFormationDTOs.First().Collaborateur.BusinessUnit.Nom); |
|
|
|
@ -159,7 +165,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual("Tours", demandeFormationDTOs.First().Collaborateur.BusinessUnit.Nom); |
|
|
|
@ -176,7 +182,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual("Gaillard", demandeFormationDTOs.First().Collaborateur.Nom); |
|
|
|
@ -193,7 +199,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual("Vasseur", demandeFormationDTOs.First().Collaborateur.Nom); |
|
|
|
@ -208,7 +214,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(new DateTime(2020, 1, 22, 9, 0, 0), demandeFormationDTOs.First().DateDemande); |
|
|
|
@ -222,7 +228,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(new DateTime(2020, 12, 22, 9, 0, 0), demandeFormationDTOs.First().DateDemande); |
|
|
|
@ -236,7 +242,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.IsFalse(demandeFormationDTOs.First().DemandeRH); |
|
|
|
@ -250,7 +256,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.IsTrue(demandeFormationDTOs.First().DemandeRH); |
|
|
|
@ -264,7 +270,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(EtatDemande.EnAttente, demandeFormationDTOs.First().EtatDemande); |
|
|
|
@ -278,7 +284,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(EtatDemande.Rejetee, demandeFormationDTOs.First().EtatDemande); |
|
|
|
@ -293,7 +299,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.IsNull(demandeFormationDTOs.First().DateDerniereReponse); |
|
|
|
@ -307,7 +313,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, asc, null, null, null, tri, null, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(new DateTime(2020, 12, 27, 9, 0, 0), demandeFormationDTOs.First().DateDerniereReponse); |
|
|
|
@ -321,7 +327,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, dateDebut, null); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, null, dateDebut, null); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.IsTrue(demandeFormationDTOs.Any(d => d.DateDemande >= dateDebut)); |
|
|
|
@ -334,7 +340,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, null, dateFin); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, null, null, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.IsTrue(demandeFormationDTOs.Any(d => d.DateDemande <= dateFin)); |
|
|
|
@ -347,7 +353,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.IsTrue(demandeFormationDTOs.Any(d => d.DateDemande >= dateDebut && d.DateDemande <= dateFin)); |
|
|
|
@ -360,7 +366,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
DemandeFormationService demandeFormationService = new DemandeFormationService(epContext, collaborateurService, transformDTO); |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, null, null, null, null, null, null, null, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.Zero(demandeFormationDTOs.Count()); |
|
|
|
@ -382,7 +388,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
idBUs = null; |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, idBUs, null, null, null, texte, null, dateDebut, dateFin); |
|
|
|
|
IEnumerable<DemandeFormationDTO> demandeFormationDTOs = await demandeFormationService.GetDemandesFormationAsync(null, idBUs, null, null, null, null, texte, null, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.Zero(demandeFormationDTOs.Count()); |
|
|
|
@ -411,7 +417,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
idBUs = null; |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
long count = await demandeFormationService.GetDemandesFormationCountAsync(null, idBUs, texte, dateDebut, dateFin); |
|
|
|
|
long count = await demandeFormationService.GetDemandesFormationCountAsync(null, idBUs, null, texte, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.Less(0, count); |
|
|
|
@ -433,7 +439,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
idBUs = null; |
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
long count = await demandeFormationService.GetDemandesFormationCountAsync(null, idBUs, texte, dateDebut, dateFin); |
|
|
|
|
long count = await demandeFormationService.GetDemandesFormationCountAsync(null, idBUs, null, texte, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
Assert.AreEqual(0, count); |
|
|
|
|