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);
        }
Exemple #2
0
 public PresenceEntity(StudentEntity student, SubjectEntity subject, DateTime date, bool present)
 {
     this.Student = student;
     this.Subject = subject;
     this.Date = date;
     this.Present = present;
 }
Exemple #3
0
 public PresenceEntity(StudentEntity student, SubjectEntity subject, DateTime date, bool present)
 {
     this.Student = student;
     this.Subject = subject;
     this.Date    = date;
     this.Present = present;
 }
        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 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_timetable_by_claas_and_subject_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.GetByClassAndSubject(clazz.Id, subject.Id);

            Assert.IsNotNull(result);
            Assert.AreEqual(model2.Id, result.Id);
        }
 public void Add_new_subject_test()
 {
     var repo = new SubjectRepository(this.context);
     var model = new SubjectEntity("AM", "Analiza matematyczna");
     repo.AddNew(model);
 }
 public TimeTableEntity(string day, ClassEntity clazz, SubjectEntity subject)
 {
     this.Day = day;
     this.Class = clazz;
     this.Subject = subject;
 }
 public void AddNew(SubjectEntity model)
 {
     this.context.Subjects.InsertOnSubmit(model);
     this.context.SubmitChanges();
 }
Exemple #11
0
 public TimeTableEntity(string day, ClassEntity clazz, SubjectEntity subject)
 {
     this.Day     = day;
     this.Class   = clazz;
     this.Subject = subject;
 }