Exemplo n.º 1
0
        public void Add()
        {
            var newmedecin = new Medecin {Nom = "Ahmed"};

            Repo.Add(newmedecin);
            var getnewmedfromrepo = Repo.Get(n => n.Nom == newmedecin.Nom).FirstOrDefault();
            Assert.AreNotEqual(getnewmedfromrepo, null);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public void AddOrUpdate()
        {
            var newmedecin = new Medecin {Nom = "Sidahmed"};

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

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

            Assert.AreNotEqual(getmedfreomrepo, null);
        }