Ejemplo n.º 1
0
        public void Add()
        {
            var newentity = new CompteRendu {Contenu="un exemple de contenu",  Nom = "Compte Rendu 1"};

            Repo.Add(newentity);
            var getentityfromrepo = Repo.Get(n => n.Nom == newentity.Nom).FirstOrDefault();
            Assert.AreNotEqual(getentityfromrepo, null);
        }
Ejemplo n.º 2
0
        public void SeExamToCompteRenduAndAdd()
        {
            var exam = ExamsRepo.Get().FirstOrDefault();
            var cr = new CompteRendu { Nom = "CR " + new Random().Next(1000), Contenu = "le contenu expemplaire", Examen = exam };
            CompteRendusRepo.Add(cr);
            var crGet = CompteRendusRepo.Get(n => n.Nom == cr.Nom).FirstOrDefault();
            var wascreatedandlinked = crGet != null && (crGet.Nom == cr.Nom && crGet.Examen != null && crGet.Examen.Nom == exam.Nom);

            Assert.IsTrue(wascreatedandlinked);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public void AddOrUpdate()
        {
            var newentity = new CompteRendu {Contenu="un exemple de contenu",  Nom = "Compte Rendu 2"};

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

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

            Assert.AreNotEqual(getentityfromrepo, null);
        }
Ejemplo n.º 5
0
        public void ResetForms()
        {
            try
            {

                SelectedCompteRendu = new CompteRendu
                {
                    ValeursPossible = new List<string>()

                };
                Examen = null;
                var newExamVm = SimpleIoc.Default.GetInstance<NewExamViewModel>();
                var newMaladeVm = SimpleIoc.Default.GetInstance<NewMaladeViewModel>();

                newMaladeVm.SelectedName = string.Empty;
                newMaladeVm.SelectedLastName = string.Empty;
                newMaladeVm.Names = new List<string>();
                newMaladeVm.LastNames = new ObservableCollection<string>();
                newMaladeVm.SelectedMalade = null;
                newMaladeVm.SelectedAge = 1;
                newExamVm.SelectedMedecin = string.Empty;
                newExamVm.Medecin = new Medecin();

                var examComptesRendusPresnts = newExamVm.SelectedExamen.ComtpesRendusPresents;
                var examName = newExamVm.SelectedExamen.Nom;

                newExamVm.SelectedExamen = new Examen();
                newExamVm.SelectedExamen.ComtpesRendusPresents = examComptesRendusPresnts;
                newExamVm.SelectedExamen.Nom = examName;

                newExamVm.ExamenBasics = new ObservableCollection<Examen>(newExamVm.ExamensBasicsRepository.Get().ToList());

                newExamVm.CanEditExam = true;

            }
            catch (Exception e)
            {
                e.SaveException();
            }
        }
Ejemplo n.º 6
0
        private void NewExam()
        {
            try
            {
                if (!CanEditExam)
                    return;
                var editableexamvm = SimpleIoc.Default.GetInstance<EditableExamenViewModel>();
                var newmaladevm = SimpleIoc.Default.GetInstance<NewMaladeViewModel>();

                NewMedecin();
                CanEditExam = false;
                var exam = SelectedExamen;
                exam.Moment = DateTime.Now;
                exam.Malade = newmaladevm.SelectedMalade;
                exam.ComptesRendus = new List<CompteRendu>();
                foreach (var compterendu in SelectedExamen.ComtpesRendusPresents)
                {
                    var temp = new CompteRendu();
                    temp.Examen = exam;
                    temp.Contenu = compterendu.Contenu;
                    temp.Nom = compterendu.Nom;
                    temp.ValeursPossible = compterendu.ValeursPossible;

                    // remove all above, add compterendu directly
                    exam.ComptesRendus.Add(temp);
                }
                exam.Medecin = Medecin;
                editableexamvm.Examen = exam;
            }
            catch (Exception e)
            {
                e.SaveException();
            }
        }
Ejemplo n.º 7
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);
        }