public void TestCreateTerms() { SqlCalendar sql = new SqlCalendar(); IEnumerable <ClassCalendar> querycal = from elem in sql.CalendarList() where elem.Month == 2 select elem; ClassCalendar calendar = querycal.First(); sql.CreateTerms("('08:00:00','12:00:00','2000-2-1',3,1,100,1),('13:00:00','15:00:00','2000-2-2',4,2,200,2)"); ClassGenerateCalendar.ShareCalendar(calendar, sql); List <ClassTerm> list = sql.ListOfTerms(); IEnumerable <ClassTerm> query = from elem in list where elem.TermId == 3 && elem.CalendarDay.CalendarDayId == 1 && elem.Doctor.Doctor_id == 1 && elem.StartTime.CompareTo(new TimeSpan(8, 0, 0)) == 0 && elem.EndTime.CompareTo(new TimeSpan(12, 0, 0)) == 0 select elem; Assert.Single(query); query = from elem in list where elem.TermId == 4 && elem.CalendarDay.CalendarDayId == 2 && elem.Doctor.Doctor_id == 2 && elem.StartTime.CompareTo(new TimeSpan(13, 0, 0)) == 0 && elem.EndTime.CompareTo(new TimeSpan(15, 0, 0)) == 0 select elem; Assert.Single(query); querycal = from elem in sql.CalendarList() where elem.Month == 2 select elem; calendar = querycal.First(); Assert.Equal(2, calendar.Status.StatusId); }
public void TestListOfTerms(int termId, int calendarDayId, int doctorId, int calendarDoctorId, int officeNumber) { SqlCalendar sql = new SqlCalendar(); IEnumerable <ClassTerm> query = from elem in sql.ListOfTerms() where elem.TermId == termId && elem.CalendarDay.CalendarDayId == calendarDayId && elem.Doctor.Doctor_id == doctorId && elem.CalendarDoctor.CalendarDoctorId == calendarDoctorId && elem.Office.OfficeNumber == officeNumber select elem; Assert.Single(query); }
public void TestDeleteTerm() { SqlCalendar sql = new SqlCalendar(); sql.DeleteTerm(1); IEnumerable <ClassTerm> query = from elem in sql.ListOfTerms() where elem.TermId == 1 select elem; Assert.Empty(query); }
public void TestUpdateOffice() { SqlCalendar sql = new SqlCalendar(); sql.UpdateOffice(1, 200); IEnumerable <ClassTerm> query = from elem in sql.ListOfTerms() where elem.TermId == 1 && elem.Office.OfficeNumber == 200 select elem; Assert.Single(query); }