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); } } } }
private Tuple<Patient, Professional[]> ProAdd(List<Follower> result, Patient p) { Professional[] proArray = new Professional[10]; Tuple<Patient, Professional[]> Follows; int x = 0; foreach (var follow in result) { if (follow.PatientId == p.PatientId) { proArray.SetValue(follow.Professionnal, x); x++; } } Follows = Tuple.Create(p, proArray); return Follows; }