From e0b433ebca4ea31322e84f185682863d5506ec03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Thu, 18 Feb 2021 09:38:19 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20jeu=20de=20donn=C3=A9es=20pour=20l?= =?UTF-8?q?es=20demandes=20de=20d=C3=A9l=C3=A9gation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/DemandeDelegationServiceTests.cs | 8 +- EPAServeur/Context/DataSeeder.cs | 222 ++++++++++++++++++ 2 files changed, 227 insertions(+), 3 deletions(-) diff --git a/EPAServeur.Tests/Services/DemandeDelegationServiceTests.cs b/EPAServeur.Tests/Services/DemandeDelegationServiceTests.cs index 952e5e6..4a34fe9 100644 --- a/EPAServeur.Tests/Services/DemandeDelegationServiceTests.cs +++ b/EPAServeur.Tests/Services/DemandeDelegationServiceTests.cs @@ -26,7 +26,7 @@ namespace EPAServeur.Tests.Services #region Setup [SetUp] - public void SetUp() + public void Setup() { // Utilisation d'une base de données en mémoire var optionBuider = new DbContextOptionsBuilder() @@ -39,6 +39,8 @@ namespace EPAServeur.Tests.Services context.Database.EnsureCreated(); context.SaveChanges(); + DataSeeder.AddDemandeDelegationEP(context); + // Ajout du jeu de données pour les tests //TO DO @@ -57,8 +59,8 @@ namespace EPAServeur.Tests.Services [TestCase("771f9129-5610-4f4b-a8eb-902a98d722be", 0)] [TestCase("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d", 3)] [TestCase("0afd1573-de75-4e5b-bfcb-1985259d8370", 1)] - [TestCase("de98a866-736f-4295-a669-92a8694e2ee3", 0)] - [TestCase("17b87130-0e9d-4b78-b0e3-a11e5f70318d", 2)] + [TestCase("de98a866-736f-4295-a669-92a8694e2ee3", 1)] + [TestCase("17b87130-0e9d-4b78-b0e3-a11e5f70318d", 1)] public async Task RecupererDemandesDelegation_OK(Guid? idReferent, int count) { IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurApi, context); diff --git a/EPAServeur/Context/DataSeeder.cs b/EPAServeur/Context/DataSeeder.cs index 92be406..ae536a0 100644 --- a/EPAServeur/Context/DataSeeder.cs +++ b/EPAServeur/Context/DataSeeder.cs @@ -1663,5 +1663,227 @@ namespace EPAServeur.Context epContext.SaveChanges(); } + /// + /// Insérer un jeu de données fictif pour les demandes de délégation + /// + /// + public static void AddDemandeDelegationEP(EpContext context) + { + Ep ep21, ep22, ep23, ep24, ep25, ep26, ep27; + DemandeDelegation dm1, dm2, dm3, dm4, dm5, dm6, dm7; + + ep21 = new Ep + { + IdEP = 21, + IdCollaborateur = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8"), + IdReferent = Guid.Parse("aa36f34c-9041-42f5-9db3-6536fe7f1696"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm1 = new DemandeDelegation() + { + IdDemandeDelegation = 1, + DateDemande = new DateTime(), + Ep = ep21, + IdReferent = new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 1" + }; + + context.DemandeDelegations.Add(dm1); + + ep22 = new Ep + { + IdEP = 22, + IdCollaborateur = Guid.Parse("e7820f92-eab1-42f5-ae96-5c16e71ff1e6"), + IdReferent = Guid.Parse("aa36f34c-9041-42f5-9db3-6536fe7f1696"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm2 = new DemandeDelegation() + { + IdDemandeDelegation = 2, + DateDemande = new DateTime(), + Ep = ep22, + IdReferent = new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 2" + }; + + context.DemandeDelegations.Add(dm2); + + ep23 = new Ep + { + IdEP = 23, + IdCollaborateur = Guid.Parse("b5254c6c-7caa-435f-a4bb-e0cf92559832"), + IdReferent = Guid.Parse("aa36f34c-9041-42f5-9db3-6536fe7f1696"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm3 = new DemandeDelegation() + { + IdDemandeDelegation = 3, + DateDemande = new DateTime(), + Ep = ep23, + IdReferent = new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 3" + }; + + context.DemandeDelegations.Add(dm3); + + ep24 = new Ep + { + IdEP = 24, + IdCollaborateur = Guid.Parse("13fbe621-1bc9-4f04-afde-b54ca076e239"), + IdReferent = Guid.Parse("771f9129-5610-4f4b-a8eb-902a98d722be"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm4 = new DemandeDelegation() + { + IdDemandeDelegation = 4, + DateDemande = new DateTime(), + Ep = ep24, + IdReferent = new Guid("0afd1573-de75-4e5b-bfcb-1985259d8370"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 4" + }; + + context.DemandeDelegations.Add(dm4); + + ep25 = new Ep + { + IdEP = 25, + IdCollaborateur = Guid.Parse("e7820f92-eab1-42f5-ae96-5c16e71ff1e6"), + IdReferent = Guid.Parse("d4fc247b-015a-44d6-8f3e-a52f0902d2bf"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm5 = new DemandeDelegation() + { + IdDemandeDelegation = 5, + DateDemande = new DateTime(), + Ep = ep25, + IdReferent = new Guid("de98a866-736f-4295-a669-92a8694e2ee3"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 5" + }; + + context.DemandeDelegations.Add(dm5); + + ep26 = new Ep + { + IdEP = 26, + IdCollaborateur = Guid.Parse("301ba7f3-095e-4912-8998-a7c942dc5f23"), + IdReferent = Guid.Parse("d4fc247b-015a-44d6-8f3e-a52f0902d2bf"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm6 = new DemandeDelegation() + { + IdDemandeDelegation = 6, + DateDemande = new DateTime(), + Ep = ep26, + IdReferent = new Guid("17b87130-0e9d-4b78-b0e3-a11e5f70318d"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 6" + }; + + context.DemandeDelegations.Add(dm6); + + + ep27 = new Ep + { + IdEP = 27, + IdCollaborateur = Guid.Parse("301ba7f3-095e-4912-8998-a7c942dc5f23"), + IdReferent = Guid.Parse("d4fc247b-015a-44d6-8f3e-a52f0902d2bf"), + IdBu = 1, + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + NumeroEp = 1, + DateCreation = new DateTime(2020, 7, 7), + DatePrevisionnelle = new DateTime(2020, 7, 8), + Obligatoire = false, + Statut = StatutEp.DatesProposees, + CV = "CV.pdf", + DateSaisie = new DateTime(2020, 7, 20) + }; + + + dm7 = new DemandeDelegation() + { + IdDemandeDelegation = 7, + DateDemande = new DateTime(), + Ep = ep27, + IdReferent = new Guid("17b87130-0e9d-4b78-b0e3-a11e5f70318d"), + EtatDemande = EtatDemande.EnAttente, + RaisonDemande = "Raison quelconque 7" + }; + + context.DemandeDelegations.Add(dm7); + + context.SaveChanges(); + } } }