private void SetUp() { // Initialiser les objets nécessaires aux tests var builder = new DbContextOptionsBuilder <ProjetsORMContexte>(); builder.UseInMemoryDatabase(databaseName: "client_db"); // Database en mémoire var contexte = new ProjetsORMContexte(builder.Options); repository = new EFClientRepository(contexte); //Initialiser données client1 = new Client() { NomClient = "ABC", NoEnregistrement = 1111, Ville = "Québec", CodePostal = "G3G1G1" }; client2 = new Client() { NomClient = "XYZ", NoEnregistrement = 1100, Ville = "Matane", CodePostal = "G5L1G1" }; }
private void SetUp() { // Initialiser les objets nécessaires aux tests var builder = new DbContextOptionsBuilder <ProjetsORMContexte>(); builder.UseInMemoryDatabase(databaseName: "employe_db"); // Database en mémoire var contexte = new ProjetsORMContexte(builder.Options); repository = new EFEmployeRepository(contexte); ctx = contexte; //Initialiser données superviseur1 = new Employe() { Nas = 123456777, Nom = "Labrecque", Prenom = "Julie", Sexe = 'F', DateEmbauche = Convert.ToDateTime("2007-09-09"), Fonction = "directeur" }; superviseur2 = new Employe() { Nas = 123456799, Nom = "Lachance", Prenom = "Pierre", Sexe = 'M', DateEmbauche = Convert.ToDateTime("2000-09-09"), Fonction = "directeur" }; }
private void CreerContexteEtReposDeTests() { var builder = new DbContextOptionsBuilder <ProjetsORMContexte>(); builder.UseInMemoryDatabase(databaseName: "client_db"); // Database en mémoire var contexte = new ProjetsORMContexte(builder.Options); repoClient = new EFClientRepository(contexte); }
private void SetUp() { // Initialiser les objets nécessaires aux tests var builder = new DbContextOptionsBuilder <ProjetsORMContexte>(); builder.UseInMemoryDatabase(databaseName: "dept_db"); // Database en mémoire var contexte = new ProjetsORMContexte(builder.Options); repository = new EFDepartementRepository(contexte); //Initialiser données departement1 = new Departement() { NomDepartement = "Info", NomComplet = "Informatique" }; departement2 = new Departement() { NomDepartement = "RH", NomComplet = "Ress.Humaines" }; employe1 = new Employe() { Nas = 123456789, Nom = "Lacasse", Prenom = "Bob", Sexe = 'M', DateEmbauche = Convert.ToDateTime("2009-09-09"), Fonction = "analyste", NomDepartement = "Info" }; contexte.Employes.Add(employe1); employe2 = new Employe() { Nas = 123456788, Nom = "Labrosse", Prenom = "Bob", Sexe = 'M', DateEmbauche = Convert.ToDateTime("2011-09-09"), Fonction = "analyste", NomDepartement = "RH" }; contexte.Employes.Add(employe2); }
static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <ProjetsORMContexte>(); optionsBuilder.UseSqlServer(ConfigurationManager.ConnectionStrings["bdProjetsORMConnectionString"].ConnectionString); ProjetsORMContexte contexte = new ProjetsORMContexte(optionsBuilder.Options); //Instanciation des repositories EFClientRepository clientRepo = new EFClientRepository(contexte); EFEmployeRepository employeRepo = new EFEmployeRepository(contexte); EFProjetRepository projetRepo = new EFProjetRepository(contexte); Console.WriteLine("Démarrage..."); Console.ReadKey(); }
static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <ProjetsORMContexte>(); optionsBuilder.UseSqlServer(ConfigurationManager.ConnectionStrings["bdProjetsORMConnectionString"].ConnectionString); ProjetsORMContexte contexte = new ProjetsORMContexte(optionsBuilder.Options); //Instanciation des repositories EFClientRepository clientRepo = new EFClientRepository(contexte); EFAffTravailRepository affTravailRepo = new EFAffTravailRepository(contexte); EFEmployeRepository employeRepo = new EFEmployeRepository(contexte); EFProjetRepository projetRepo = new EFProjetRepository(contexte); EFDepartementRepository departementRepo = new EFDepartementRepository(contexte); Console.WriteLine("Démarrage..."); if (contexte.Employes.Count() == 0) { //Mettre en place le code nécessaire pour exécuter la procédure stockée PR_PREMIER_CHARGEMENT_PROJETS_ORM } Console.ReadKey(); }
private void SetUp() { // Initialiser les objets nécessaires aux tests var builder = new DbContextOptionsBuilder <ProjetsORMContexte>(); builder.UseInMemoryDatabase(databaseName: "projet_db"); // Database en mémoire var contexte = new ProjetsORMContexte(builder.Options); repository = new EFProjetRepository(contexte); //Initialiser données client1 = new Client() { NomClient = "ABC", NoEnregistrement = 1111, Ville = "Québec", CodePostal = "G3G1G1" }; client2 = new Client() { NomClient = "XYZ", NoEnregistrement = 1100, Ville = "Québec", CodePostal = "G3G1G3" }; contexte.Clients.Add(client1); contexte.Clients.Add(client2); employe1 = new Employe() { Nas = 123456789, Nom = "Lacasse", Prenom = "Bob", Sexe = 'M', DateEmbauche = Convert.ToDateTime("2009-09-09"), Fonction = "analyste" }; contexte.Employes.Add(employe1); projet1 = new Projet() { NomClient = client1.NomClient, NomProjet = "TelIP", Budget = 10000, NoGestionnaire = employe1.NoEmploye }; projet2 = new Projet() { NomClient = client1.NomClient, NomProjet = "Wifi", Budget = 15000, NoGestionnaire = employe1.NoEmploye }; projet3 = new Projet() { NomClient = client2.NomClient, NomProjet = "Test", Budget = 50000, NoGestionnaire = employe1.NoEmploye }; }
public EFClientRepository(ProjetsORMContexte contexte) { }
public EFEmployeRepository(ProjetsORMContexte contexte) { }