예제 #1
0
        public void Constructor_OnDuplicateCourses()
        {
            // Build mockup object with duplicate entry.
            var factory = new CourseMockupFactory();
            var course  = factory.BuildDummy(1);

            var courses = new List <Course>();

            courses.Add(course);
            courses.Add(course);

            var permutator = new CoursePermutator(courses);
        }
        public void IsAvailable_OnNoPrerequisite()
        {
            // Build mockup objects with no pre-requisites.
            var factory = new CourseMockupFactory();
            var course  = factory.BuildDummy(1);

            var completedCourseDictionary = new Dictionary <int, bool>();

            completedCourseDictionary.Add(course.Id, false);

            // If course is not completed and has no pre-requisite, should return true.
            Assert.IsTrue(CourseAvailabilityChecker.IsAvailable(completedCourseDictionary, course));

            // If course is completed, should return false.
            completedCourseDictionary[course.Id] = true;
            Assert.IsFalse(CourseAvailabilityChecker.IsAvailable(completedCourseDictionary, course));
        }