Esempio n. 1
0
        public void GetHashCode_TwoEqualSubjects_ReturnsDifferenHash()
        {
            var course1 = GetTestUCourse();
            var course2 = new UCourse(course1.ID + 1, course1.NumberOfHours, "abc");

            Assert.NotStrictEqual(course1.GetHashCode(), course2.GetHashCode());
        }
Esempio n. 2
0
        public void Equals_ComparedSubjectHasDifferentData_ReturnsFalse()
        {
            var course1 = GetTestUCourse();
            var course2 = new UCourse(course1.ID + 1, course1.NumberOfHours, "abc");

            Assert.False(course1.Equals(course2));
        }
Esempio n. 3
0
        public void Equals_ComparedUCourseIsNull_ReturnsFalse()
        {
            var     course          = GetTestUCourse();
            UCourse comapredSubject = null;

            Assert.False(course.Equals(comapredSubject));
        }
Esempio n. 4
0
 void AddMandatoryCourse(UCourse course)
 {
     if (_mandatoryCoursesReferencingCount.ContainsKey(course.Id))
     {
         _mandatoryCoursesReferencingCount[course.Id]++;
     }
     else
     {
         _mandatoryCoursesReferencingCount.Add(course.Id, 1);
         _lstMandatoryCoursesItems.Add(course);
     }
 }
Esempio n. 5
0
        void RemoveMandatoryCourse(UCourse course)
        {
            int referencesCount = _mandatoryCoursesReferencingCount[course.Id];

            if (referencesCount == 1)
            {
                _lstMandatoryCoursesItems.Remove(course);
                _mandatoryCoursesReferencingCount.Remove(course.Id);
            }
            else
            {
                _mandatoryCoursesReferencingCount[course.Id]--;
            }
        }
        private UClass GetTestUClass(UCourse subject = null, string teacherName = null, IEnumerable <DayOfWeek> days = null, TimeSpan?startTime = null, TimeSpan?endTime = null, int?section = null, int?capacity = null, int?numberOfRegisteredStudents = null, int?year = null, USemester?semester = null)
        {
            subject = subject ?? new UCourse(0, 1, "qwetyuiop[");

            teacherName = teacherName ?? "wertyuio";
            days        = days ?? new DayOfWeek[] { DayOfWeek.Sunday, DayOfWeek.Tuesday, DayOfWeek.Thursday };
            startTime   = startTime ?? TimeSpan.FromHours(8);
            endTime     = endTime ?? TimeSpan.FromHours(9);
            section     = section ?? 1;
            capacity    = capacity ?? 30;
            numberOfRegisteredStudents = numberOfRegisteredStudents ?? 27;
            year     = year ?? 2018;
            semester = semester ?? USemester.First;
            return(new UClass(course: subject, instructorName: teacherName, days: days, startTime: startTime.Value, endTime: endTime.Value, section: section.Value, capacity: capacity.Value, numberOfRegisteredStudents: numberOfRegisteredStudents.Value, year: year.Value, semester: semester.Value));
        }