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_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 AddNew(TimeTableEntity model)
 {
     this.context.TimeTables.InsertOnSubmit(model);
     this.context.SubmitChanges();
 }