예제 #1
0
        public void DeleteVisit_RemovesVisitFromDataStore()
        {
            using (var vc = new VisitContext())
            {
                var visit = new Visit
                {
                    VisitDate          = DateTime.Now,
                    Appointment        = Convert.ToSByte(true),
                    ArrivingTime       = DateTime.Now.TimeOfDay,
                    StartTimeInterview = DateTime.Now.TimeOfDay,
                    DepartureTime      = DateTime.Now.TimeOfDay,
                    User   = (from v in vc.DataContext.Users where v.Id == 1 select v).First(),
                    Doctor = (from d in vc.DataContext.Doctors where d.User.Id == 1 select d).First()
                };

                vc.CreateVisit(visit);
                vc.DeleteVisit(visit);
                Assert.IsFalse(vc.DataContext.Visits.Find(visit.Id) == visit);
            }
        }