コード例 #1
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 );
        }
コード例 #2
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() );
        }
コード例 #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 );
        }
コード例 #4
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:" );
            }
        }