MAJ des tests unitaires pour le service et l'api engagement

develop
jboinembalome 4 years ago
parent 87f887be0c
commit 4e101f472c
  1. 6
      EPAServeur.Tests/Controllers/EngagementsApiTests.cs
  2. 6
      EPAServeur.Tests/Services/EngagementServiceTests.cs

@ -132,7 +132,7 @@ namespace EPAServeur.Tests.Controllers
List<long> idBUs = new List<long> { 1, 2 }; List<long> idBUs = new List<long> { 1, 2 };
// Act // Act
var okResult = engagementsApiController.GetEngagementsCount(idBUs, null, true, 1, 5, null, null); var okResult = engagementsApiController.GetEngagementsCount(idBUs, null, null);
// Assert // Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result); Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
@ -144,10 +144,10 @@ namespace EPAServeur.Tests.Controllers
// Arrange // Arrange
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object); EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
List<long> idBUs = new List<long> { 1, 2 }; List<long> idBUs = new List<long> { 1, 2 };
int nbEngagement = 5; int nbEngagement = 12;
// Act // Act
var okResult = engagementsApiController.GetEngagementsCount(idBUs, null, true, 1, 5, null, null).Result as OkObjectResult; var okResult = engagementsApiController.GetEngagementsCount(idBUs, null, null).Result as OkObjectResult;
// Assert // Assert
Assert.IsInstanceOf<long>(okResult.Value); Assert.IsInstanceOf<long>(okResult.Value);

@ -327,7 +327,7 @@ namespace EPAServeur.Tests.Services
#region Tests GetEngagementsCountAsync #region Tests GetEngagementsCountAsync
[TestCase(new long[] { 1, 2, 3 }, "formation")] [TestCase(new long[] { 1, 2, 3 }, "Coty")]
[TestCase(new long[] { 1 }, null)] [TestCase(new long[] { 1 }, null)]
public async Task GetEngagementsCountAsync_PasseDesParamsValides_RetourneLeNombreTotalDEngagements(long[] arrIdBUs, string texte) public async Task GetEngagementsCountAsync_PasseDesParamsValides_RetourneLeNombreTotalDEngagements(long[] arrIdBUs, string texte)
{ {
@ -341,7 +341,7 @@ namespace EPAServeur.Tests.Services
idBUs = new List<long>(); idBUs = new List<long>();
// Act // Act
long count = await engagementService.GetEngagementsCountAsync(idBUs, null, null, null, null, texte, null); long count = await engagementService.GetEngagementsCountAsync(idBUs, null, texte);
// Assert // Assert
Assert.Less(0, count); Assert.Less(0, count);
@ -362,7 +362,7 @@ namespace EPAServeur.Tests.Services
idBUs = new List<long>(); idBUs = new List<long>();
// Act // Act
long count = await engagementService.GetEngagementsCountAsync(idBUs, null, null, null, null, texte, null); long count = await engagementService.GetEngagementsCountAsync(idBUs, null, texte);
// Assert // Assert
Assert.AreEqual(0, count); Assert.AreEqual(0, count);

Loading…
Cancel
Save