public void testParseGraduationDateSS() { String sXML = "<StudentSnapshot StudentPersonalRefId='12345678901234567890'>" + " <GradYear Type='Actual'>2005</GradYear>" + "</StudentSnapshot>"; StudentSnapshot sp = (StudentSnapshot) parseSIF15r1XML( sXML ); sp = (StudentSnapshot) AdkObjectParseHelper.WriteParseAndReturn( sp, SifVersion.SIF15r1 ); Assertion.AssertNotNull( sp ); PartialDateType gd = sp.GraduationDate; Assertion.AssertNotNull( "Actual Grad Year", gd ); Assertion.AssertEquals( "Actual Grad Year", 2005, (int) gd.Year ); Adk.SifVersion = SifVersion.SIF15r1; sp = new StudentSnapshot(); sp.SetElementOrAttribute( "GradYear[@Type='Actual']", "2054" ); gd = sp.GraduationDate; Assertion.AssertNotNull( "Actual Grad Year", gd ); Assertion.AssertEquals( "Actual Grad Year", 2054, (int) gd.Year ); Element gradValue = sp.GetElementOrAttribute( "GradYear[@Type='Actual']" ); Assertion.AssertNotNull( "Actual Grad Year", gradValue ); Assert.IsTrue( gradValue is PartialDateType, "Should be a partial date type" ); PartialDateType gradYear = (PartialDateType) gradValue; Assertion.AssertEquals( "Actual Grad Year", 2054, gradYear.Year.Value ); }
public void testParseProjectedGradYearSS() { String sXML = "<StudentSnapshot StudentPersonalRefId='12345678901234567890'>" + " <GradYear Type='Projected'>2012</GradYear>" + "</StudentSnapshot>"; StudentSnapshot sp = (StudentSnapshot) parseSIF15r1XML( sXML ); sp = (StudentSnapshot) AdkObjectParseHelper.WriteParseAndReturn( sp, SifVersion.SIF15r1 ); Assertion.AssertNotNull( sp ); Assertion.AssertNotNull( "Projected Grad Year", sp.ProjectedGraduationYear ); Assertion.AssertEquals( "Projected Grad Year", 2012, (int) sp .ProjectedGraduationYear ); Adk.SifVersion = SifVersion.SIF15r1; sp = new StudentSnapshot(); sp.SetElementOrAttribute( "GradYear[@Type='Projected']", "2089" ); Assertion.AssertNotNull( "Projected Grad Year", sp.ProjectedGraduationYear ); Assertion.AssertEquals( "Projected Grad Year", 2089, (int) sp.ProjectedGraduationYear ); Element gradValue = sp.GetElementOrAttribute( "GradYear[@Type='Projected']" ); Assertion.AssertNotNull( "Projected Grad Year", gradValue ); SifInt intValue = (SifInt) gradValue.SifValue; Assertion.AssertEquals( "Projected Grad Year", 2089, intValue.Value.Value ); }
public void testParseOnTimeGradYearSS() { String sXML = "<StudentSnapshot StudentPersonalRefId='12345678901234567890'>" + " <GradYear Type='Original'>1971</GradYear>" + "</StudentSnapshot>"; StudentSnapshot sp = (StudentSnapshot) parseSIF15r1XML( sXML ); sp = (StudentSnapshot) AdkObjectParseHelper.WriteParseAndReturn( sp, SifVersion.SIF15r1 ); Assertion.AssertNotNull( sp ); Assertion.AssertNotNull( "On Time Grad Year", sp.OnTimeGraduationYear ); Assertion.AssertEquals( "On Time Grad Year", 1971, (int) sp .OnTimeGraduationYear ); Adk.SifVersion = SifVersion.SIF15r1; sp = new StudentSnapshot(); sp.SetElementOrAttribute( "GradYear[@Type='Original']", "8877" ); Assertion.AssertNotNull( "On Time Grad Year", sp.OnTimeGraduationYear ); Assertion.AssertEquals( "On Time Grad Year", 8877, (int) sp.OnTimeGraduationYear ); Element gradValue = sp.GetElementOrAttribute( "GradYear[@Type='Original']" ); Assertion.AssertNotNull( "On Time Grad Year is null", gradValue ); SifInt intValue = (SifInt) gradValue.SifValue; Assertion.AssertEquals( "On Time Grad Year", 8877, intValue.RawValue ); }