예제 #1
0
        public void Add()
        {
            var newentity = new Examen {Nom = "Topo",Moment = DateTime.Now};

            Repo.Add(newentity);
            var getentityfromrepo = Repo.Get(n => n.Nom == newentity.Nom).FirstOrDefault();
            Assert.AreNotEqual(getentityfromrepo, null);
        }
예제 #2
0
        public void AddAllInOne()
        {
            var medecin = new Medecin {Nom = "Toubib"};
            var malade = new Malade {Nom = "Hmdaoui", Prenom = "Kalbou3", Age = 96};
            var exam = new Examen {Moment = DateTime.Now, Nom = "Examen Compliqué", Medecin = medecin, Malade = malade};
            var cr1 = new CompteRendu {Nom = "Un Compte Rendu au Hazard", Contenu = "Voilà le contenu", Examen = exam};
            CompteRendusRepo.Add(cr1);
            var cr1Get = CompteRendusRepo.Get(n => n.Nom == "Un Compte Rendu au Hazard").FirstOrDefault();
            var virified = cr1Get.Examen.Moment== exam.Moment;

                virified = virified && cr1Get.Examen.Medecin.Nom == medecin.Nom && cr1Get.Examen.Malade.Nom == malade.Nom;
            Assert.IsTrue(virified);
        }
예제 #3
0
        public void AddOrUpdate()
        {
            var newentity = new Examen { Nom = "Angio", Moment = DateTime.Now };

            Repo.AddOrUpdate(newentity);
            //var getnewmedfromrepo = Repo.Get(n => n.Nom == newentity.Nom);

            var getentityfromrepo = Repo.Get(n => n.Nom == "Angio").FirstOrDefault();
            if (getentityfromrepo != null)
                getentityfromrepo.Nom = "Hamid";
            else
            {
                Assert.IsTrue(false);
            }
            Repo.AddOrUpdate(getentityfromrepo);
            getentityfromrepo = null;
            getentityfromrepo = Repo.Get(n => n.Nom == "Hamid").FirstOrDefault();

            Assert.AreNotEqual(getentityfromrepo, null);
        }
예제 #4
0
 private void ResetComptesRendus(Examen exam)
 {
     try
     {
         if (exam!=null && exam.ComptesRendus!=null)
             foreach (var comptesRendu in exam.ComptesRendus)
             {
                 comptesRendu.Contenu=string.Empty;
             }
     }
     catch (Exception e)
     {
         e.SaveException();
     }
 }
예제 #5
0
        public void SimpleCreationScenario()
        {
            var malade = MaladeRepo.Get().FirstOrDefault();
            var medecin = MedecinRepo.Get().FirstOrDefault();
            var exam = new Examen
            {
                Nom = "L'examen"+new Random().Next(-1000,100),
                Medecin = medecin,
                Malade = malade,

            };
            exam.Moment =  DateTime.Now;
            var cr1 = new CompteRendu { Nom = "CR " + new Random().Next(1000,9000), Contenu = "le contenu expemplaire numéro "+ new Random().Next(1000,9000), Examen = exam };
            var cr2 = new CompteRendu { Nom = "CR " + new Random().Next(1000, 9000), Contenu = "le contenu expemplaire numéro " + new Random().Next(100, 900), Examen = exam };
            var cr3 = new CompteRendu { Nom = "CR " + new Random().Next(1000, 9000), Contenu = "le contenu expemplaire numéro " + new Random().Next(10, 90), Examen = exam };
            var cr4 = new CompteRendu { Nom = "CR " + new Random().Next(1000, 9000), Contenu = "le contenu expemplaire numéro " + new Random().Next(50, 99), Examen = exam };
            CompteRendusRepo.Add(cr1);
            var cr1Get = CompteRendusRepo.Get(n => n.Nom == cr1.Nom).FirstOrDefault();
            Assert.AreNotEqual(cr1Get,null);
            var cr2Get = CompteRendusRepo.Get(n => n.Nom == cr2.Nom).FirstOrDefault();
            Assert.AreNotEqual(cr2Get, null);
            var cr3Get = CompteRendusRepo.Get(n => n.Nom == cr3.Nom).FirstOrDefault();
            Assert.AreNotEqual(cr3Get, null);
            var cr4Get = CompteRendusRepo.Get(n => n.Nom == cr4.Nom).FirstOrDefault();
            Assert.AreNotEqual(cr4Get, null);
        }