/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="refId">The ID (GUID) that uniquely identifies this section entity.</param> ///<param name="schoolCourseInfoRefId">The ID (GUID) that identifies the course being taught in this section.</param> ///<param name="schoolYear">School year for which the information is applicable, expressed as the four-digit year in which the school year ends (e.g. 2007 for the 2006-07 school year).</param> ///<param name="scheduleInfoList">The schedule-related information for a section</param> /// public SectionInfo( string refId, string schoolCourseInfoRefId, int? schoolYear, ScheduleInfoList scheduleInfoList ) : base(Adk.SifVersion, StudentDTD.SECTIONINFO) { this.RefId = refId; this.SchoolCourseInfoRefId = schoolCourseInfoRefId; this.SchoolYear = schoolYear; this.ScheduleInfoList = scheduleInfoList; }
public void ParseSectionInfo() { // Parse the object from the file Console.WriteLine("Parsing from file..."); SifParser p = SifParser.NewInstance(); SectionInfo sectionInfo = null; using (Stream inStream = GetResourceStream("SectionInfo.xml")) { sectionInfo = (SectionInfo)p.Parse(inStream, null, SifParserFlags.None, SifVersion.SIF15r1); inStream.Close(); } Assert.IsNotNull(sectionInfo); ScheduleInfoList schedules = sectionInfo.ScheduleInfoList; Assert.AreEqual(2, schedules.Count, "Should have two ScheduleInfo elements"); ScheduleInfo[] scheds = schedules.ToArray(); // Assert the first ScheduleInfo Assert.AreEqual(2, scheds[0].TeacherList.Count, "Should have two teachers"); Assert.AreEqual(5, scheds[0].MeetingTimeList.Count, "Should have 5 meeeting times"); // Assert the second ScheduleInfo Assert.AreEqual(1, scheds[1].TeacherList.Count, "Should have one teacher"); Assert.AreEqual(5, scheds[1].MeetingTimeList.Count, "Should have 5 meeeting times"); // Assert that the SchoolCourseInfoOverride parsed correctly SchoolCourseInfoOverride cio = sectionInfo.SchoolCourseInfoOverride; Assert.IsNotNull(cio.CourseCredits, "Should have a CourseCreditsOverrides"); // NOTE: This will currently fail every time, due to a bug in // CompareGraphTo AdkObjectParseHelper.runParsingTest(sectionInfo, SifVersion.SIF15r1); }
public void testSectionInfoMappings() { SectionInfo si = new SectionInfo(); Mappings mappings = fCfg.Mappings.GetMappings("Default"); IDictionary map = new Hashtable(); map.Add("STAFF_REFID", "123456789ABCDEF"); StringMapAdaptor sma = new StringMapAdaptor(map); mappings.MapOutbound(sma, si); si = (SectionInfo)AdkObjectParseHelper.WriteParseAndReturn(si, fVersion); // Assert that the object was mapped correctly ScheduleInfoList sil = si.ScheduleInfoList; Assertion.AssertNotNull(sil); ScheduleInfo schedule = sil.ItemAt(0); Assertion.AssertNotNull(schedule); TeacherList tl = schedule.TeacherList; Assertion.AssertNotNull(tl); StaffPersonalRefId refId = tl.ItemAt(0); Assertion.AssertNotNull(refId); Assertion.AssertEquals("123456789ABCDEF", refId.Value); // Now, map the object back to a hashmap and assert it IDictionary restoredData = new Hashtable(); sma = new StringMapAdaptor(restoredData); mappings.MapInbound(si, sma); assertMapsAreEqual(map, restoredData); }