public void testRetrieveDailyPlanViewObjWithClassSectionId() { _course0.LastDisplayedClassSectionId = _classSection0.Id; _user0.LastDisplayedCourseId = _course0.Id; _course0.LastDisplayedLessonId = _lesson0.Id; DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(_classSection0.Id, _user0.Id, Guid.Empty, _classSection0.Id, false, Guid.Empty, true, 2, Guid.Empty); /* This block reorders and then checks to make sure values were set correctly within the * SetClassMeetingValues method for the reference class section and it's class meeting domain obj's. * The assertions are based on the paths that will be taken as a result of value definitions for the * class meetingdbObjects contained in our setup */ viewObj.ReferenceCalendarClassMeetingObjList = viewObj.ReferenceCalendarClassMeetingObjList .OrderBy(x => x.MeetingNumber).ToList(); Assert.IsTrue(viewObj.ReferenceCalendarClassMeetingObjList.ElementAt(0).IsNextClass); Assert.AreEqual(viewObj.ReferenceCalendarClassMeetingObjList.ElementAt(1).ClassNumber, -1); Assert.AreEqual(viewObj.ReferenceCalendarClassMeetingObjList.ElementAt(2).WeekNumber, 1); foreach (var x in viewObj.ReferenceCalendarClassMeetingObjList) { Assert.AreEqual(x.ClassCount, 2); } }
public void testRetrieveDailyPlanViewObjLocatingClassSectionThroughLastSelectedInCourseObj() { _course0.LastDisplayedClassSectionId = _classSection0.Id; _user0.LastDisplayedCourseId = _course0.Id; _course0.LastDisplayedLessonId = _lesson0.Id; // Any asserts that would have been repeats from the previous method have been omitted, // we are only asserting new behaviors accessed by the different parameters DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(Guid.Empty, _user0.Id, Guid.Empty, _classSection2.Id, false, Guid.Empty, true, 2, Guid.Empty); Assert.AreEqual(_user0.Id, viewObj.CurrentUserObj.Id); Assert.AreEqual(_classSection0.Id, viewObj.SelectedClassSectionId); // These lines assert the proper Guids exist in the Possible select list, // branch accessed through showAddReferenceCalendar boolean in parameter list being true List <String> guidList = new List <ClassSection>() { _classSection0, _classSection1 } .Select(x => x.Id.ToString()).ToList(); Assert.Contains(viewObj.ReferenceCalendarPossibleClassSectionSelectList.ElementAt(0).Value, guidList); Assert.Contains(viewObj.ReferenceCalendarPossibleClassSectionSelectList.ElementAt(1).Value, guidList); // Accessed by including a referenceClassSectionId, but the ClassSection has no assigned meetings, // hence the empty list assertion Assert.AreEqual("Hide Reference Calendar", viewObj.ReferenceCalDropdownHeading); Assert.IsEmpty(viewObj.ReferenceCalendarClassMeetingObjList); Assert.AreEqual(_classSection2.Id, viewObj.ReferenceClassSectionId); }
public void testRetrieveWithoutLastDisplayedLessonIdOrLessonUse() { _course0.LastDisplayedClassSectionId = _classSection0.Id; _user0.LastDisplayedCourseId = _course0.Id; _course0.LastDisplayedLessonId = Guid.Empty; DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(Guid.Empty, _user0.Id, Guid.Empty, _classSection0.Id, false, Guid.Empty, true, 2, Guid.Empty); Assert.AreEqual(viewObj.CourseObj.SelectedLessonId, Guid.Empty); }
public void testRetrieveDailyPlanViewObjWithClassSectionLocatedThroughClassMeeting() { _course0.LastDisplayedClassSectionId = _classSection1.Id; _user0.LastDisplayedCourseId = _course0.Id; _course0.LastDisplayedLessonId = Guid.Empty; // Since we can locate a ClassSection through the ClassMeeting Id passed as parameter, // this is the first time we'll access the bulk of the method, hence the additional Asserts. DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(Guid.Empty, _user0.Id, _lesson0.Id, Guid.Empty, false, _lessonUse0.Id, false, 1, _classMeeting0.Id); // Checks that the setLastDisplayed methods worked correctly Assert.AreEqual(_course0.LastDisplayedLessonId, _lesson0.Id); Assert.AreEqual(_course0.LastDisplayedClassSectionId, _classSection0.Id); Assert.AreEqual(viewObj.SelectedLessonUseSequencNumber, _lessonUse0.SequenceNumber); Assert.AreEqual(viewObj.CourseObj.Id, _user0.LastDisplayedCourseId); // Checks that all class sections in the current term related to course are in the basic list, // branch accessed by switching showAllTerms boolean to false List <Guid> classSectionIds = _classSectionList.Where(x => x.Course.Term.IsCurrent).Select(x => x.Id).ToList(); foreach (var xClassSectionDomainObjBasic in viewObj.ClassSectionDomainObjBasicList) { Assert.Contains(xClassSectionDomainObjBasic.Id, classSectionIds); } //These lines assert the proper Guids exist in the regular select list List <String> guidList = _referenceSectionsForClassSection0.Select(x => x.Id.ToString()).ToList(); Assert.Contains(viewObj.ReferenceCalendarClassSectionSelectList.ElementAt(0).Value, guidList); Assert.Contains(viewObj.ReferenceCalendarClassSectionSelectList.ElementAt(1).Value, guidList); Assert.AreEqual(_user0.Id, viewObj.CurrentUserObj.Id); Assert.AreEqual(_classSection0.Id, viewObj.SelectedClassSectionId); Assert.AreEqual(_lessonUse0.Id, viewObj.SelectedLessonUseId); Assert.AreEqual("Select Reference Calendar", viewObj.ReferenceCalDropdownHeading); //tests the booleans set using the Hash Set returned by the private method "GetUsedLessonIdSet" foreach (var xLessonDomainObj in viewObj.CourseObj.ContainerChildLessons) { Assert.True(xLessonDomainObj.IsForPlanning); Assert.True(xLessonDomainObj.IsUsedInPlan); Assert.Contains(xLessonDomainObj.Id, _lessonList.Select(x => x.Id).ToList()); } }
public void testMethodsWithUnrelatedClassSectionId() { _course0.LastDisplayedClassSectionId = _classSection0.Id; _user0.LastDisplayedCourseId = _course0.Id; _course0.LastDisplayedLessonId = _lesson0.Id; DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(Guid.NewGuid(), _user0.Id, Guid.Empty, _classSection0.Id, false, Guid.Empty, true, 2, Guid.Empty); Assert.IsNull(viewObj.ClassSectionObj); ClassSectionDomainObj classSectionDomainObj = DailyPlanningViewObjBuilder .SetClassMeetingValues(_classSectionBuilder.Object .BuildFromId(Guid.NewGuid()), Guid.Empty, Guid.Empty); Assert.IsNull(classSectionDomainObj); }
public void testRetrieveDailyPlanViewObjWithoutLocatableClassSection() { _user0.LastDisplayedCourseId = Guid.Empty; DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(Guid.Empty, _user0.Id, _lesson0.Id, Guid.Empty, true, _lessonUse0.Id, true, 1, Guid.Empty); // Checks that all class sections in all terms related to course are in the basic list List <Guid> classSectionIds = _classSectionList.Select(x => x.Id).ToList(); foreach (var xClassSectionDomainObjBasic in viewObj.ClassSectionDomainObjBasicList) { Assert.Contains(xClassSectionDomainObjBasic.Id, classSectionIds); } Assert.AreEqual(_user0.Id, viewObj.CurrentUserObj.Id); Assert.AreEqual(Guid.Empty, viewObj.SelectedClassSectionId); Assert.AreEqual(_lessonUse0.Id, viewObj.SelectedLessonUseId); }
public void testRetrieveWithUnconnectedLessonUse() { _course0.LastDisplayedClassSectionId = _classSection0.Id; _user0.LastDisplayedCourseId = _course0.Id; _course0.LastDisplayedLessonId = _lesson0.Id; // This lesson use has no lesson object attached. We need this to test that the // lastDisplayedLessonId isn't changed if the LessonUse is Unconnected to a Lesson LessonUse lessonUse = new LessonUse() { Id = Guid.NewGuid(), ClassMeetingId = Guid.NewGuid(), SequenceNumber = 42 }; _lessonUseList.Add(lessonUse); DailyPlanViewObj viewObj = _viewObjBuilder.RetrieveDailyPlanViewObj(Guid.Empty, _user0.Id, Guid.Empty, _classSection0.Id, false, lessonUse.Id, true, 2, Guid.Empty); Assert.AreEqual(viewObj.SelectedLessonUseSequencNumber, lessonUse.SequenceNumber); Assert.AreEqual(_course0.LastDisplayedLessonId, _lesson0.Id); _lessonUseList.Remove(lessonUse); }