public void testSubjectAreaSIF15r1() { Adk.SifVersion = SifVersion.SIF15r1; SchoolCourseInfo sci = new SchoolCourseInfo(); SubjectAreaList lst = new SubjectAreaList(); sci.SubjectAreaList = lst; SubjectArea sa = new SubjectArea( "13" ); sa.TextValue = "Graphic Arts"; // for SIF 1.x ??? OtherCodeList ocl = new OtherCodeList(); ocl.Add( new OtherCode( Codeset.TEXT, "Graphic Arts" ) ); sa.OtherCodeList = ocl; lst.Add( sa ); StringWriter sw = new StringWriter(); SifWriter sifw = new SifWriter( sw ); sifw.Write( sci ); sifw.Flush(); sifw.Close(); String xml = sw.ToString(); Console.WriteLine( xml ); int found = xml.IndexOf( ">Graphic Arts</SubjectArea>" ); Assertion.Assert( found > -1 ); }
public void testCourseCodeSIF15r1() { Adk.SifVersion = SifVersion.SIF15r1; SchoolCourseInfo sci = new SchoolCourseInfo(); sci.SetCourseCredits( CreditType.C0108_0585, 2 ); SifXPathContext spc = SifXPathContext.NewSIFContext( sci ); Element value = (Element) spc.GetValue( "CourseCredits[@Code='0585']" ); SifSimpleType elementValue = value.SifValue; Assertion.AssertNotNull( "Value by XPath", elementValue ); Assertion.AssertEquals( "Value By XPath", 2, elementValue.RawValue ); }
public void testSchoolCourseInfo() { IDictionary values = new Hashtable(); values.Add( "CREDVALUE", "0" ); values.Add( "MAXCREDITS", "1" ); StringMapAdaptor sma = new StringMapAdaptor( values ); SchoolCourseInfo sc = new SchoolCourseInfo(); sc.SchoolYear = 1999; Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null, null, null ); m.MapOutbound( sma, sc, SifVersion.SIF15r1 ); Console.WriteLine( sc.ToXml() ); Element e = sc.GetElementOrAttribute( "CourseCredits[@Code='01']" ); Assertion.AssertNotNull( "credits", e ); Assertion.AssertEquals( "credits", "0", e.TextValue ); e = sc.GetElementOrAttribute( "CourseCredits[@Code='02']" ); Assertion.AssertNotNull( "maxcredits", e ); Assertion.AssertEquals( "maxcredits", "1", e.TextValue ); }