示例#1
0
 public IList<Models.Patient> GetAllPatients()
 {
     using (var db = new EReferralContext())
     {
         return db.Patients.ToList();
     }
 }
示例#2
0
 public Patient AddPatient(Patient patient)
 {
     using (var db = new EReferralContext())
     {
         var returnedPatient = db.Patients.Add(patient);
         db.SaveChanges();
         return returnedPatient;
     }
 }
示例#3
0
        public void GetAllPatients_Should_Return_Patients()
        {
            // Arrange
            using (var context = new EReferralContext())
            {
                context.Patients.Add(new Patient { Email = "*****@*****.**" });
                context.Patients.Add(new Patient { Email = "*****@*****.**" });
                context.SaveChanges();
            }

            var service = new ReferralService();

            // Act
            var patients = service.GetAllPatients();

            // Assert
            patients.ShouldNotBeNull();
            patients.Count.ShouldEqual(2);
        }