public void Get_subject_by_id_test() { var repo = new SubjectRepository(context); var model = new SubjectEntity("AM", "Analiza matematyczna"); var model2 = new SubjectEntity("MD", "Matematyka dyskretna"); repo.AddNew(model); repo.AddNew(model2); var result = repo.GetById(model2.Id); Assert.IsNotNull(result); Assert.AreEqual(model2.Id, result.Id); }
public void Get_timetable_by_id_test() { var repo = new TimeTableRepository(context); var classRepo = new ClassRepository(context); var subjectRepo = new SubjectRepository(context); ClassEntity clazz = new ClassEntity("GR1"); classRepo.AddNew(clazz); SubjectEntity subject = new SubjectEntity("AM", "Analiza"); subjectRepo.AddNew(subject); TimeTableEntity model = new TimeTableEntity("poniedziałek", clazz, subject); TimeTableEntity model2 = new TimeTableEntity("wtorek", clazz, subject); repo.AddNew(model); repo.AddNew(model2); var result = repo.GetById(2); Assert.IsNotNull(result); Assert.AreEqual(2, result.Id); Assert.AreEqual(model2.Class.Id, result.Class.Id); Assert.AreEqual(model2.Subject.Id, result.Subject.Id); Assert.AreEqual(model2.Day, result.Day); }
public void Add_new_subject_test() { var repo = new SubjectRepository(this.context); var model = new SubjectEntity("AM", "Analiza matematyczna"); repo.AddNew(model); }
public void Get_presences_by_student_and_subject_test() { var repo = new PresenceRepository(this.context); var studrepo = new StudentRepository(this.context); var timerepo = new TimeTableRepository(this.context); var classrepo = new ClassRepository(this.context); var subrepo = new SubjectRepository(this.context); ClassEntity clazz = new ClassEntity("GR1"); classrepo.AddNew(clazz); StudentEntity model = new StudentEntity("Aneta", "Dams", clazz, true); studrepo.AddNew(model); SubjectEntity subject = new SubjectEntity("AM", "Analiza Matematyczna"); subrepo.AddNew(subject); TimeTableEntity timeTable = new TimeTableEntity("poniedziałek", clazz, subject); var model1 = new PresenceEntity(model, subject, DateTime.Now.Date, true); var model2 = new PresenceEntity(model, subject, DateTime.Now.Date.AddDays(2), true); repo.AddNew(model1); repo.AddNew(model2); var result = repo.GetAllByStudentAndSubject(model.Id, subject.Id); Assert.IsNotNull(result); Assert.AreEqual(2, result.Count); Assert.AreEqual(model1.Id, result[0].Id); Assert.AreEqual(model2.Id, result[1].Id); }
public void Add_new_timetable_test() { var repo = new TimeTableRepository(context); var classRepo = new ClassRepository(context); var subjectRepo = new SubjectRepository(context); ClassEntity clazz = new ClassEntity("GR1"); classRepo.AddNew(clazz); SubjectEntity subject = new SubjectEntity("AM", "Analiza"); subjectRepo.AddNew(subject); TimeTableEntity model = new TimeTableEntity("poniedziałek", clazz, subject); repo.AddNew(model); }
public void Add_new_presence_test() { var repo = new PresenceRepository(this.context); var studrepo = new StudentRepository(this.context); var timerepo = new TimeTableRepository(this.context); var classrepo = new ClassRepository(this.context); var subrepo = new SubjectRepository(this.context); ClassEntity clazz = new ClassEntity("GR1"); classrepo.AddNew(clazz); StudentEntity model = new StudentEntity("Aneta", "Dams", clazz, true); studrepo.AddNew(model); SubjectEntity subject = new SubjectEntity("AM", "Analiza Matematyczna"); subrepo.AddNew(subject); TimeTableEntity timeTable = new TimeTableEntity("poniedziałek", clazz, subject); var model1 = new PresenceEntity(model, subject, DateTime.Now.Date, true); repo.AddNew(model1); }
public void Get_all_timetables_by_class_test() { var repo = new TimeTableRepository(context); var classRepo = new ClassRepository(context); var subjectRepo = new SubjectRepository(context); ClassEntity clazz = new ClassEntity("GR1"); ClassEntity clazz2 = new ClassEntity("GR2"); classRepo.AddNew(clazz); classRepo.AddNew(clazz2); SubjectEntity subject = new SubjectEntity("AM", "Analiza"); subjectRepo.AddNew(subject); TimeTableEntity model = new TimeTableEntity("poniedziałek", clazz2, subject); TimeTableEntity model2 = new TimeTableEntity("wtorek", clazz, subject); repo.AddNew(model); repo.AddNew(model2); var result = repo.GetAllByClass("GR1"); Assert.IsNotNull(result); Assert.AreEqual("GR1", result[0].Class.Id); }