Mise à jour des tests EP en cours

develop
Yanaël GRETTE 4 years ago
parent 559cec8611
commit 2a8d199020
  1. 4
      EPAServeur.Tests/Controllers/EpInformationApiTests.cs
  2. 1
      EPAServeur.Tests/Services/EpDetailsServiceTests.cs
  3. 20
      EPAServeur.Tests/Services/EpInformationTests.cs

@ -61,7 +61,7 @@ namespace EPAServeur.Tests.Controllers
public async Task GetEpEnCours() public async Task GetEpEnCours()
{ {
EpApiController epApiController = new EpApiController(epInformationService, logger); EpApiController epApiController = new EpApiController(epInformationService, logger);
Task<IActionResult> task = epApiController.GetEPEnCours(new List<long?>() { 1, 2 }, true, 1, 15, "", "", null, null); Task<IActionResult> task = epApiController.GetEPEnCours(new List<long?>() { 1, 2 }, true, 1, 15, "", true, "", null, null);
OkObjectResult result = task.Result as OkObjectResult; OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode); Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value); Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value);
@ -71,7 +71,7 @@ namespace EPAServeur.Tests.Controllers
public async Task GetEpEnCoursCount() public async Task GetEpEnCoursCount()
{ {
EpApiController epApiController = new EpApiController(epInformationService, logger); EpApiController epApiController = new EpApiController(epInformationService, logger);
Task<IActionResult> task = epApiController.GetEPEnCoursCount(new List<long?>() { 1, 2 }, "", null, null); Task<IActionResult> task = epApiController.GetEPEnCoursCount(new List<long?>() { 1, 2 }, "", true, null, null);
OkObjectResult result = task.Result as OkObjectResult; OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode); Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<int>(result.Value); Assert.IsInstanceOf<int>(result.Value);

@ -15,6 +15,7 @@ using System.Threading.Tasks;
namespace EPAServeur.Tests.Services namespace EPAServeur.Tests.Services
{ {
[TestFixture]
public class EpDetailsServiceTests public class EpDetailsServiceTests
{ {
#region variables #region variables

@ -63,8 +63,8 @@ namespace EPAServeur.Tests.Services
{ {
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?>{ idBUs }, true, 1, 15, "", "", null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?>{ idBUs }, true, 1, 15, "", true,"", null, null);
int count = await epInformationService.GetEPEnCoursCount(new List<long?> { idBUs }, "", null, null); int count = await epInformationService.GetEPEnCoursCount(new List<long?> { idBUs }, "", true, null, null);
Assert.AreEqual(count, nbElements); Assert.AreEqual(count, nbElements);
Assert.AreEqual(count, epInformationDTOs.Count()); Assert.AreEqual(count, epInformationDTOs.Count());
foreach(EpInformationDTO ep in epInformationDTOs) foreach(EpInformationDTO ep in epInformationDTOs)
@ -79,8 +79,8 @@ namespace EPAServeur.Tests.Services
{ {
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1,2 }, true, 1, 15, "", "", null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1,2 }, true, 1, 15, "", true, "", null, null);
int count = await epInformationService.GetEPEnCoursCount(new List<long?> { 1, 2 }, "", null, null); int count = await epInformationService.GetEPEnCoursCount(new List<long?> { 1, 2 }, "", true, null, null);
Assert.AreEqual(count, 6); Assert.AreEqual(count, 6);
Assert.AreEqual(count, epInformationDTOs.Count()); Assert.AreEqual(count, epInformationDTOs.Count());
long? bu; long? bu;
@ -104,7 +104,7 @@ namespace EPAServeur.Tests.Services
public async Task GetEpEnCours_TriColonneASC(string tri) public async Task GetEpEnCours_TriColonneASC(string tri)
{ {
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", tri, null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", true, tri, null, null);
EpInformationDTO ep1, ep2; EpInformationDTO ep1, ep2;
int compare = 0; int compare = 0;
for(int i = 0; i < epInformationDTOs.Count()-1; ++i) for(int i = 0; i < epInformationDTOs.Count()-1; ++i)
@ -157,7 +157,7 @@ namespace EPAServeur.Tests.Services
public async Task GetEpEnCours_TriColonneDESC(string tri) public async Task GetEpEnCours_TriColonneDESC(string tri)
{ {
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, false, 1, 15, "", tri, null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, false, 1, 15, "", true, tri, null, null);
EpInformationDTO ep1, ep2; EpInformationDTO ep1, ep2;
int compare = 0; int compare = 0;
for (int i = 0; i < epInformationDTOs.Count() - 1; ++i) for (int i = 0; i < epInformationDTOs.Count() - 1; ++i)
@ -206,7 +206,7 @@ namespace EPAServeur.Tests.Services
DateTime date = new DateTime(a, m, j); DateTime date = new DateTime(a, m, j);
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", "", date, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", true, "", date, null);
Assert.AreEqual(epInformationDTOs.Count(), count); Assert.AreEqual(epInformationDTOs.Count(), count);
foreach(EpInformationDTO ep in epInformationDTOs) foreach(EpInformationDTO ep in epInformationDTOs)
{ {
@ -222,7 +222,7 @@ namespace EPAServeur.Tests.Services
{ {
DateTime date = new DateTime(a, m, j); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); DateTime date = new DateTime(a, m, j); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", "", null, date); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", true, "", null, date);
Assert.AreEqual(epInformationDTOs.Count(), count); Assert.AreEqual(epInformationDTOs.Count(), count);
foreach (EpInformationDTO ep in epInformationDTOs) foreach (EpInformationDTO ep in epInformationDTOs)
{ {
@ -242,7 +242,7 @@ namespace EPAServeur.Tests.Services
DateTime date2 = new DateTime(a2, m2, j2); DateTime date2 = new DateTime(a2, m2, j2);
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", "", date1, date2); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", true, "", date1, date2);
Assert.AreEqual(epInformationDTOs.Count(), count); Assert.AreEqual(epInformationDTOs.Count(), count);
foreach (EpInformationDTO ep in epInformationDTOs) foreach (EpInformationDTO ep in epInformationDTOs)
{ {
@ -263,7 +263,7 @@ namespace EPAServeur.Tests.Services
public async Task GetEpEnCours_texte(string texte, int count) public async Task GetEpEnCours_texte(string texte, int count)
{ {
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, texte, "", null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, texte, true, "", null, null);
Assert.AreEqual(count, epInformationDTOs.Count()); Assert.AreEqual(count, epInformationDTOs.Count());
foreach (EpInformationDTO ep in epInformationDTOs) foreach (EpInformationDTO ep in epInformationDTOs)
{ {

Loading…
Cancel
Save