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 );
        }
Ejemplo n.º 2
0
        public void testStudentSnapshot20_NullLastName()
        {
            Adk.SifVersion = SifVersion.LATEST;
            StringMapAdaptor sma = createStudentSnapshotFields();

            // SASI Expects that a null string will result in
            // the field not being mapped. Checking that here
            sma.Dictionary["LASTNAME"] = null ;
            StudentSnapshot ss = new StudentSnapshot();

            Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null,
                                                                        null, null );
            m.MapOutbound( sma, ss, SifVersion.LATEST );
            String value = ss.ToXml();
            Console.WriteLine( value );

            Assertion.Assert( "Last Name should be null", value.IndexOf( "LastName" ) == -1 );
        }
Ejemplo n.º 3
0
        public void testStudentSnapshot20_EmptyGradYear()
        {
            Adk.SifVersion = SifVersion.LATEST;
            StringMapAdaptor sma = createStudentSnapshotFields();

            // SASI Expects that an empty string in a grad year
            // field will not produce an error, but rather an empty element
            sma.Dictionary[ "ORIGYRGRAD" ] = "" ;
            StudentSnapshot ss = new StudentSnapshot();

            Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null,
                                                                        null, null );
            m.MapOutbound( sma, ss, SifVersion.LATEST );
            Console.WriteLine( ss.ToXml() );

            int? onTimeGradYear = ss.OnTimeGraduationYear;
            Assertion.Assert( "onTimeGraduationYear is not null", !onTimeGradYear.HasValue );
        }
Ejemplo n.º 4
0
        public void testStudentSnapshot20r1()
        {
            StringMapAdaptor sma = createStudentSnapshotFields();
            StudentSnapshot ss = new StudentSnapshot();

            Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null,
                                                                        null, null );
            m.MapOutbound( sma, ss, SifVersion.SIF20r1 );

            int? onTimeGradYear = ss.OnTimeGraduationYear;
            Assertion.Assert( "onTimeGraduationYear is null", onTimeGradYear.HasValue );
            Assertion.AssertEquals( "OnTimeGraduationYear", 2000, onTimeGradYear.Value );

            Console.WriteLine( ss.ToXml() );
        }
Ejemplo n.º 5
0
        public void testStudentSnapshot15r1()
        {
            StringMapAdaptor sma = createStudentSnapshotFields();
            StudentSnapshot ss = new StudentSnapshot();
            ss.StudentPersonalRefId = Adk.MakeGuid();
            ss.SnapDate = DateTime.Now;

            Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null,
                                                                        null, null );
            m
                .MapOutbound( sma, ss, new DefaultValueBuilder( sma ),
                              SifVersion.SIF15r1 );
            Console.WriteLine( ss.ToXml() );

            int? onTimeGradYear = ss.OnTimeGraduationYear;
            Assertion.Assert( "onTimeGraduationYear is null", onTimeGradYear.HasValue );
            Assertion.AssertEquals( "OnTimeGraduationYear", 2000, onTimeGradYear.Value );

            SchemaValidator sv = USSchemaValidator.NewInstance( SifVersion.SIF15r1 );

            // 3) Validate the file
            bool validated = sv.Validate( ss, SifVersion.SIF15r1 );

            // 4) If validation failed, write the object out for tracing purposes
            if ( !validated )
            {
                sv.PrintProblems( Console.Out );
                Assertion.Fail( "Schema Validation Failed:" );
            }
        }
        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 );
        }