Пример #1
0
        public void GetFollower()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                Dictionary<Patient, Professional[]> expectedFollow = new Dictionary<Patient, Professional[]>();
                Professional[] proArray = new Professional[10];

                proArray.SetValue(context.SelectRequest.SelectProfessional("SimonF", "SimonF"), 0);
                proArray.SetValue(context.SelectRequest.SelectProfessional("ClementR", "ClementR"), 1);
                proArray.SetValue(context.SelectRequest.SelectProfessional("OlivierS", "OlivierS"), 2);

                expectedFollow.Add(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"), proArray);
                Dictionary<Patient, Professional[]> allFollow = _followerService.getDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);


                foreach (var pair in allFollow)
                {
                    Assert.AreEqual(pair.Key.PatientId, context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
                    for (int i = 0; i < 3; i++)
                    {
                        Assert.AreEqual(pair.Value[i].ProfessionalId, proArray[i].ProfessionalId);
                    }
                }
            }
        }
Пример #2
0
        public void GetUserWithPseudoAndPassword()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                _data = _userService.getUser("ClementR", "ClementR");
                Assert.AreEqual(_data.User.UserId, context.SelectRequest.SelectUser("ClementR", "ClementR").UserId);
                Assert.AreEqual(_data.Followers.Count, context.SelectRequest.SelectAllFollow(context.SelectRequest.SelectUser("ClementR", "ClementR").UserId).Count);

            }
        }
Пример #3
0
        public void GetUserWithId()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                User u = _userService.getUser(context.SelectRequest.SelectUser("clementR","clementR").UserId);
                Assert.AreEqual(u.LastName, "Rousseau");
                int id = u.UserId;

                User u2 = _userService.getUser(id);
                Assert.AreEqual(u.LastName, "Rousseau");
            }
        }
Пример #4
0
        public void PostUser()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                int id = context.SelectRequest.SelectUser("clementR", "clementR").UserId;
                User u = _userService.getUser(id);
                u.City = "Paris";
                _userService.PostUser(u);
                Assert.AreEqual(u.City, ("Paris"));
                u.City = "Ivry-sur-Seine";
                _userService.PostUser(u);
                Assert.AreEqual(u.City, ("Ivry-sur-Seine"));
            }

        }
Пример #5
0
        public void PostPrescription()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                DocumentManager dm = new DocumentManager(context);
                List<Professional> listPro = new List<Professional>();
                listPro.Add(context.SelectRequest.SelectProfessional("ClementR", "ClementR"));
                listPro.Add(context.SelectRequest.SelectProfessional("SimonF", "SimonF"));
                User Sender = context.SelectRequest.SelectUser("OlivierS", "OlivierS");
                string Title = "My Title2";
                Patient P = context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF");
                string DocPath = P.PatientId + "$" + Sender.UserId;
                ImageManager img = new ImageManager();
                Image i = img.LoadImage(Sender.Photo);
                Prescription p = new Prescription(Title, Sender.Photo, Sender, listPro, P);

                _documentService.putPrescription(p);

                DocumentSerializable document = dm.SeeDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR"), context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"));

                foreach (var prescription in document.Prescriptions)
                {
                    if (prescription.Title == "MyTitle2")
                    {
                        _documentService.postPrescripton(context.SelectRequest.SelectPatient("GuillaumF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId, prescription.Date);

                        Assert.That(prescription.Receivers.Count == 3);

                        foreach (var pro in prescription.Receivers)
                        {
                            _documentService.deletePrescription(prescription, prescription.DocPath);
                        }

                        Assert.That(prescription.Receivers.Count == 2);

                    }
                }
            }
        }
Пример #6
0
        public void PutDocPrescription()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                DocumentManager dm = new DocumentManager(context);
                List<Professional> listPro = new List<Professional>();
                listPro.Add(context.SelectRequest.SelectProfessional("ClementR", "ClementR"));
                listPro.Add(context.SelectRequest.SelectProfessional("SimonF", "SimonF"));
                User Sender = context.SelectRequest.SelectUser("OlivierS", "OlivierS");
                string Title = "My Title";
                Patient P = context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF");
                string DocPath = P.PatientId + "$" + Sender.UserId;
                Prescription p = new Prescription(Title, Sender.Photo, Sender, listPro, P);

                _documentService.putPrescription(p);
                DocumentSerializable document = dm.SeeDocument(context.SelectRequest.SelectProfessional("OlivierS", "OlivierS"), context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"));
                Assert.AreEqual(document.Prescriptions.Count, 3);
            }
        }
Пример #7
0
        public void PostMessage()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                DocumentManager dm = new DocumentManager(context);
                List<Professional> listPro = new List<Professional>();
                listPro.Add(context.SelectRequest.SelectProfessional("ClementR", "ClementR"));
                listPro.Add(context.SelectRequest.SelectProfessional("SimonF", "SimonF"));
                User Sender = context.SelectRequest.SelectUser("AntoineR", "AntoineR");
                string Title = "My Title2";
                string Contents = "My Contents";
                Patient P = context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF");

                _documentService.putMessage(listPro, Sender, Title, Contents, P);


                DocumentSerializable document = dm.SeeDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR"), context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"));

                foreach (var message in document.Messages)
                {
                    if (message.Title == "MyTitle2")
                    {
                        _documentService.postMessage(context.SelectRequest.SelectPatient("GuillaumF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId, message.Date);

                        Assert.That(message.Receivers.Count == 3);

                        foreach (var pro in message.Receivers)
                        {
                            _documentService.deleteMessage(pro.ProfessionalId, message.Patient.PatientId, message.Date);
                        }

                        Assert.That(message.Receivers.Count == 2);

                    }
                }
            }

        }
Пример #8
0
        public void PutDocMessage()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                DocumentManager dm = new DocumentManager(context);
                List<Professional> listPro = new List<Professional>();
                listPro.Add(context.SelectRequest.SelectProfessional("ClementR", "ClementR"));
                listPro.Add(context.SelectRequest.SelectProfessional("SimonF", "SimonF"));
                User Sender = context.SelectRequest.SelectUser("AntoineR", "AntoineR");
                string Title = "My Title";
                string Contents = "My Contents";
                Patient P = context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF");

                _documentService.putMessage(listPro, Sender, Title, Contents, P);

                DocumentSerializable document = dm.SeeDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR"), context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"));
                Assert.AreEqual(document.Messages.Count, 1);


            }
        }
Пример #9
0
 public void GetDocPatient()
 {
     using (ArchiViteContext context = new ArchiViteContext())
     {
         DocumentSerializable doc = _documentService.SeeDocument(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
         Assert.IsNotNull(doc);
     }
 }
Пример #10
0
 public ContextManager()
 {
     _context = new ArchiViteContext();
 }
Пример #11
0
        public void DeleteFollower()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                _followerService.DeleteFollowerCheck(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);
                Assert.IsNull(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId));

                FollowerCreation myNewFollow = new FollowerCreation(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId,
                    context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);
                _followerService.PutFollower(myNewFollow);

            }

        }
Пример #12
0
 public void GetPatient()
 {
     using (ArchiViteContext context = new ArchiViteContext())
     {
         Patient p = _patientService.getPatient(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
         Assert.AreEqual(p.PatientId, context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
     }
 }
Пример #13
0
        public void PutFollower()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                _doc = new DocumentManager(context);
                FollowerCreation myNewFollow = new FollowerCreation(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId,
                    context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId);
                _followerService.PutFollower(myNewFollow);

                Dictionary<Patient, Professional[]> allFollow = _followerService.getDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);
                foreach (var pair in allFollow)
                {
                    Assert.AreEqual(pair.Value[0].ProfessionalId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId);
                }

                _doc.DeleteFollowerFile(context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId, context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
                context.SuppressionRequest.FollowerSuppression(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId));
                Assert.IsNull(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId));
            }
        }
Пример #14
0
 public AddRequest(ArchiViteContext context)
 {
     _context = context;        
 }
Пример #15
0
 public SelectRequest(ArchiViteContext context)
 {
     _context = context;
 }
Пример #16
0
 public void GetArrayBytesOfAnImage()
 {
     using (ArchiViteContext context = new ArchiViteContext())
     {
         List<User> users = context.User.ToList();
         foreach (var u in users)
         {
             ImageManager img = new ImageManager();
             Image i = img.LoadImage(u.Photo);
             byte[] array = img.ImageCoverter(i);
         }
     }
 }
Пример #17
0
 public SuppressionRequest(ArchiViteContext context)
 {
     _context = context;
 }
Пример #18
0
 public void GetProfessional()
 {
     using (ArchiViteContext context = new ArchiViteContext())
     {
         Professional p = _professionalService.getProfessional(context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);
         Assert.AreEqual(p.ProfessionalId, context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);
     }
 }
Пример #19
0
 public UpdateRequest(ArchiViteContext context)
 {
     _context = context;
 }
Пример #20
0
        public void PutAndDeleteProfessional()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                _doc = new DocumentManager(context);
                User userTest = new User()
                {
                    FirstName = "TEST",
                    LastName = "TEST",
                    Birthdate = DateTime.Now,
                    Adress = "72 avenue maurice thorez",
                    City = "Ivry-sur-Seine",
                    Postcode = 12345,
                    PhoneNumber = 0606066606,
                    Pseudo = "test",
                    Password = "******",
                    Photo = "yolo"
                };

                ProfessionalCreation newPro = new ProfessionalCreation(userTest, "testeur");
                _professionalService.putProfessional(newPro);
                Assert.IsNotNull(context.SelectRequest.SelectProfessional("test", "mdp"));

                _professionalService.DeleteProfessionalCheck(context.SelectRequest.SelectProfessional("test", "mdp").ProfessionalId);
                Assert.IsNull(context.SelectRequest.SelectProfessional("test", "mdp"));
            }
        }
Пример #21
0
 public DocumentManager(ArchiViteContext context)
 {
     _context = context;
     _supp = new SuppressionRequest(context);
 }