Exemplo n.º 1
0
 public StudentEntity(string name, string surname, ClassEntity clazz, bool gender)
 {
     this.Name    = name;
     this.Surname = surname;
     this.Gender  = gender;
     this.Class   = clazz;
 }
Exemplo n.º 2
0
 public StudentEntity(string name, string surname, ClassEntity clazz, bool gender)
 {
     this.Name = name;
     this.Surname = surname;
     this.Gender = gender;
     this.Class = clazz;
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void Add_new_class_test()
        {
            // this.SetupAll();

            var repo = new ClassRepository(connString);
            var model = new ClassEntity("GR1");

            repo.AddNew(model);
        }
Exemplo n.º 5
0
        public void Add_new_student_test()
        {
            var repo = new StudentRepository(this.context);
            var classRepo = new ClassRepository(context);
            var clazz = new ClassEntity("GR1");
            classRepo.AddNew(clazz);
            var model = new StudentEntity("Aneta","Dams", clazz, true);

            repo.AddNew(model);
        }
Exemplo n.º 6
0
        public void Get_class_by_id_test()
        {
            var repo = new ClassRepository(context);
                var model = new ClassEntity("GR2");
                var model2 = new ClassEntity("GR1");

                repo.AddNew(model);
                repo.AddNew(model2);
                var result = repo.GetById(model2.Id);

                Assert.IsNotNull(result);
                Assert.AreEqual(result.Id, model2.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);
        }
Exemplo n.º 8
0
        public void Get_all_classes_test()
        {
            var repo = new ClassRepository(context);
            var model = new ClassEntity("GR2");
            var model2 = new ClassEntity("GR1");

            repo.AddNew(model);
            repo.AddNew(model2);
            var result = repo.GetAll();

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Count, 2);
            Assert.AreEqual(model.Id, result[1].Id);
            Assert.AreEqual(model2.Id, result[0].Id);
        }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
        public void Get_student_by_id_test()
        {
            var repo = new StudentRepository(this.context);
            var classRepo = new ClassRepository(context);
            var clazz = new ClassEntity("GR1");
            classRepo.AddNew(clazz);
            var model = new StudentEntity("Aneta", "Dams", clazz, true);
            var model2 = new StudentEntity("Mateusz", "Brzeziński", clazz, false);
            repo.AddNew(model);
            repo.AddNew(model2);

            var result = repo.GetById(model2.Id);

            Assert.IsNotNull(result);
            Assert.AreEqual(model2.Id, result.Id);
            Assert.AreEqual(model2.Gender, result.Gender);
            Assert.AreEqual(model2.Name, result.Name);
            Assert.AreEqual(model2.Surname, result.Surname);
            Assert.IsNotNull(result.Class);
            Assert.AreEqual(model2.Class.Id, result.Class.Id);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        public void Get_all_students_by_class_test()
        {
            var repo = new StudentRepository(this.context);
            var classRepo = new ClassRepository(context);
            var clazz = new ClassEntity("GR1");
            var clazz2 = new ClassEntity("GR2");
            classRepo.AddNew(clazz);
            classRepo.AddNew(clazz2);
            var model = new StudentEntity("Aneta", "Dams", clazz, true);
            var model2 = new StudentEntity("Mateusz", "Brzeziński", clazz, false);
            var model3 = new StudentEntity("Joanna", "Kowalska", clazz2, true);
            repo.AddNew(model);
            repo.AddNew(model2);
            repo.AddNew(model3);

            var result = repo.GetAllByClass(clazz.Id);

            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(clazz.Id, result[0].Class.Id);
            Assert.AreEqual(clazz.Id, result[1].Class.Id);
            Assert.AreEqual(model2.Id, result[0].Id);
            Assert.AreEqual(model.Id, result[1].Id);
        }
Exemplo n.º 13
0
 public TimeTableEntity(string day, ClassEntity clazz, SubjectEntity subject)
 {
     this.Day = day;
     this.Class = clazz;
     this.Subject = subject;
 }
Exemplo n.º 14
0
 public void AddNew(ClassEntity entity)
 {
     this.context.Classes.InsertOnSubmit(entity);
     this.context.SubmitChanges();
 }
Exemplo n.º 15
0
 public void Add_new_class_test()
 {
     var repo = new ClassRepository(context);
     var model = new ClassEntity("GR1");
     repo.AddNew(model);
 }
Exemplo n.º 16
0
 public TimeTableEntity(string day, ClassEntity clazz, SubjectEntity subject)
 {
     this.Day     = day;
     this.Class   = clazz;
     this.Subject = subject;
 }