Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }