Ajout des tests unitaires pour le tri du nombre de participant à une formation

develop
jboinembalome 4 years ago
parent 5e3c971282
commit 647ac6537f
  1. 30
      EPAServeur.Tests/Services/FormationServiceTests.cs

@ -261,6 +261,36 @@ namespace EPAServeur.Tests.Services
}
[TestCase(true, "participants")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParNombreDeParticipantsCroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(0, formationDTOs.First().NbParticipations);
Assert.AreEqual(3, formationDTOs.Last().NbParticipations);
}
[TestCase(false, "participants")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParNombreDeParticipantsDecroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(3, formationDTOs.First().NbParticipations);
Assert.AreEqual(0, formationDTOs.Last().NbParticipations);
}
[TestCase(true, "origine")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineCroissante(bool? asc, string tri)
{

Loading…
Cancel
Save