|
|
|
@ -7,6 +7,7 @@ using IO.Swagger.DTO; |
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
using NUnit.Framework; |
|
|
|
|
using System; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
@ -49,7 +50,7 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region Test getCollaborateur |
|
|
|
|
#region Tests getCollaborateur |
|
|
|
|
|
|
|
|
|
[TestCase("842650db-a548-4472-a3af-4c5fff3c1ab8")] |
|
|
|
|
[TestCase("301ba7f3-095e-4912-8998-a7c942dc5f23")] |
|
|
|
@ -97,5 +98,77 @@ namespace EPAServeur.Tests.Services |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Tests GetCollaborateurs Roles |
|
|
|
|
|
|
|
|
|
[TestCase("RH")] //9 |
|
|
|
|
[TestCase("Collaborateur")] //7 |
|
|
|
|
[TestCase("Assistant")] //6 |
|
|
|
|
[TestCase("Manager")]//10 |
|
|
|
|
[TestCase("RA")]//5 |
|
|
|
|
public async Task GetCollaborateurs_UnRole(string role) |
|
|
|
|
{ |
|
|
|
|
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context); |
|
|
|
|
|
|
|
|
|
List<string> roles = new List<string>(); |
|
|
|
|
roles.Add(role); |
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, null, true, 1, 50, "", "", null, null); |
|
|
|
|
int count = await collaborateurService.GetCollaborateursCountAsync(roles, null, "", null, null); |
|
|
|
|
|
|
|
|
|
Assert.AreEqual(count, collaborateurs.Count()); |
|
|
|
|
|
|
|
|
|
switch (role) |
|
|
|
|
{ |
|
|
|
|
case "RH": |
|
|
|
|
Assert.AreEqual(count, 9); |
|
|
|
|
break; |
|
|
|
|
case "Collaborateur": |
|
|
|
|
Assert.AreEqual(count, 7); |
|
|
|
|
break; |
|
|
|
|
case "Assistant": |
|
|
|
|
Assert.AreEqual(count, 6); |
|
|
|
|
break; |
|
|
|
|
case "Manager": |
|
|
|
|
Assert.AreEqual(count, 10); |
|
|
|
|
break; |
|
|
|
|
case "RA": |
|
|
|
|
Assert.AreEqual(count, 5); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public async Task GetCollaborateurs_RoleRH_RoleAssistant() |
|
|
|
|
{ |
|
|
|
|
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context); |
|
|
|
|
|
|
|
|
|
List<string> roles = new List<string>(); |
|
|
|
|
roles.Add("Assistant"); |
|
|
|
|
roles.Add("RH"); |
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, null, true, 1, 50, "", "", null, null); |
|
|
|
|
int count = await collaborateurService.GetCollaborateursCountAsync(roles, null, "", null, null); |
|
|
|
|
Assert.AreEqual(count, 15); Assert.AreEqual(count, collaborateurs.Count()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public async Task GetCollaborateurs_RoleRA_RoleManager() |
|
|
|
|
{ |
|
|
|
|
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context); |
|
|
|
|
|
|
|
|
|
List<string> roles = new List<string>(); |
|
|
|
|
roles.Add("Manager"); |
|
|
|
|
roles.Add("RA"); |
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, null, true, 1, 50, "", "", null, null); |
|
|
|
|
int count = await collaborateurService.GetCollaborateursCountAsync(roles, null, "", null, null); |
|
|
|
|
Assert.AreEqual(count, collaborateurs.Count()); |
|
|
|
|
Assert.AreEqual(count, 15); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|