Corrections de bugs pour la gestion des clés étrangères

develop
Yanaël GRETTE 4 years ago
parent 2a8d199020
commit d15c4a3a3b
  1. 20
      EPAServeur.Tests/Services/EpInformationTests.cs
  2. 1
      EPAServeur/Context/EpContext.cs
  3. 2
      EPAServeur/Models/EP/DemandeEPI.cs
  4. 2
      EPAServeur/Models/EP/RdvEntretien.cs
  5. 2
      EPAServeur/Startup.cs

@ -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, "", true,"", null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?>{ idBUs }, true, 1, 15, "", false,"", null, null);
int count = await epInformationService.GetEPEnCoursCount(new List<long?> { idBUs }, "", true, null, null); int count = await epInformationService.GetEPEnCoursCount(new List<long?> { idBUs }, "", false, 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, "", true, "", null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1,2 }, true, 1, 15, "", false, "", null, null);
int count = await epInformationService.GetEPEnCoursCount(new List<long?> { 1, 2 }, "", true, null, null); int count = await epInformationService.GetEPEnCoursCount(new List<long?> { 1, 2 }, "", false, 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, "", true, tri, null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, 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, "", true, tri, null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, false, 1, 15, "", false, 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, "", true, "", date, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, "", 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, "", true, "", null, date); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, "", 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, "", true, "", date1, date2); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, "", 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, true, "", null, null); IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, texte, false, "", null, null);
Assert.AreEqual(count, epInformationDTOs.Count()); Assert.AreEqual(count, epInformationDTOs.Count());
foreach (EpInformationDTO ep in epInformationDTOs) foreach (EpInformationDTO ep in epInformationDTOs)
{ {

@ -90,7 +90,6 @@ namespace EPAServeur.Context
entity.HasOne<DemandeEPI>(e => e.DemandeEPI).WithOne(a => a.Ep).HasForeignKey<DemandeEPI>(a => a.IdEP); entity.HasOne<DemandeEPI>(e => e.DemandeEPI).WithOne(a => a.Ep).HasForeignKey<DemandeEPI>(a => a.IdEP);
}); });
modelBuilder.Entity<Objectif>(entity => modelBuilder.Entity<Objectif>(entity =>
{ {
entity.HasKey(e => e.IdObjectif); entity.HasKey(e => e.IdObjectif);

@ -49,7 +49,7 @@ namespace EPAServeur.Models.EP
/// <summary> /// <summary>
/// Id de l'EP /// Id de l'EP
/// </summary> /// </summary>
public long IdEP { get; set; } public long? IdEP { get; set; }
/// <summary> /// <summary>
/// EP qui est lié à la demande d'EPI /// EP qui est lié à la demande d'EPI

@ -18,7 +18,7 @@ namespace EPAServeur.Models.EP
/// <summary> /// <summary>
/// Id EP concernant le choix du rendez-vous /// Id EP concernant le choix du rendez-vous
/// </summary> /// </summary>
public long IdEPChoixRDV { get; set; } public long? IdEPChoixRDV { get; set; }
/// <summary> /// <summary>
/// Date proposée/prévue pour l’entretien /// Date proposée/prévue pour l’entretien

@ -109,8 +109,8 @@ namespace EPAServeur
DataSeeder.AddChamps(context); DataSeeder.AddChamps(context);
DataSeeder.AddNotes(context); DataSeeder.AddNotes(context);
DataSeeder.AddDemandeDelegationEP(context); DataSeeder.AddDemandeDelegationEP(context);
DataSeeder.AddEp(context);
DataSeeder.AddEngagements(context); DataSeeder.AddEngagements(context);
DataSeeder.AddEp(context);
DataSeeder.AddRereferentEP(context); DataSeeder.AddRereferentEP(context);
} }
//faire using, check si kekchoz exkist puis appeler les m<EFBFBD>thodes de cr<EFBFBD>ation si il n'y a rien //faire using, check si kekchoz exkist puis appeler les m<EFBFBD>thodes de cr<EFBFBD>ation si il n'y a rien

Loading…
Cancel
Save