From 647ac6537f3fc2fbcc50839d8c83404378b249a8 Mon Sep 17 00:00:00 2001 From: jboinembalome Date: Fri, 19 Feb 2021 13:49:27 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20tests=20unitaires=20pour=20le=20t?= =?UTF-8?q?ri=20du=20nombre=20de=20participant=20=C3=A0=20une=20formation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/FormationServiceTests.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/EPAServeur.Tests/Services/FormationServiceTests.cs b/EPAServeur.Tests/Services/FormationServiceTests.cs index cefa3b6..e2954c5 100644 --- a/EPAServeur.Tests/Services/FormationServiceTests.cs +++ b/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 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 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) {