示例#1
0
        public void TestNameParsed(
            string name,
            int expectedYear,
            SemesterLink.SemesterType expectedType,
            int expectedSortingNumber,
            int expectedSessionID)
        {
            SemesterLink slt = new SemesterLink()
            {
                Link = "",
                Name = name,
            };

            Assert.AreEqual(expectedYear, slt.Year);
            Assert.AreEqual(expectedType, slt.Type);
            Assert.AreEqual(expectedSortingNumber, slt.GetSortingNumber());
            Assert.AreEqual(expectedSessionID, slt.GetSessionID());
        }
        protected void HandleSemester(SemesterLink semester)
        {
            TutorListPageRequest tlpr = new TutorListPageRequest(client, semester.Link, TUTOR_NAME);

            tlpr.Perform();

            foreach (var subject in tlpr.Subjects)
            {
                logger.Log(semester.Name + " =>\n" + "Группа: "
                           + subject.Group + ", предмет " + subject.SubjectName);

                var mpr = new ModulesPageRequest(client, subject.Url);
                mpr.Perform();
                var tutors = mpr.Tutors;

                if (tutors.Count > 1 && !tutors[0].Name.Contains(TUTOR_NAME))
                {
                    logger.Log(TUTOR_NAME + " не основной преподаватель, пропускаем.");
                    continue;
                }

                Session session          = this.sessionCache[semester.GetSessionID()];
                string  groupSessionLink = session.GetGroupLink(subject.Group);

                GroupSessionPageRequest gspr = new GroupSessionPageRequest(
                    client,
                    groupSessionLink,
                    subject.SubjectName
                    );
                gspr.Perform();

                logger.Log("Найдено оценок: " + gspr.Marks.Count);

                foreach (var mark in gspr.Marks)
                {
                    logger.Log(String.Format("{0} ({1}): {2}", mark.Key.Name, mark.Key.Gender, mark.Value.Value));
                    this.calculator.AddData(mark.Key, mark.Value);
                }
            }
        }