Exemple #1
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:");
            }
        }
Exemple #2
0
        public void testStudentSnapshot15r1_Adk20r1()
        {
            Adk.SifVersion = SifVersion.SIF15r1;
            StringMapAdaptor sma = createStudentSnapshotFields();
            StudentSnapshot  ss  = new StudentSnapshot();
            Mappings         m   = fCfg.Mappings.GetMappings("Default").Select(null,
                                                                               null, null);

            m.MapOutbound(sma, ss, SifVersion.SIF20r1);
            Console.WriteLine(ss.ToXml());

            int?onTimeGradYear = ss.OnTimeGraduationYear;

            Assertion.Assert("onTimeGraduationYear is null", onTimeGradYear.HasValue);
            Assertion.AssertEquals("OnTimeGraduationYear", 2000, onTimeGradYear.Value);
        }
Exemple #3
0
        public void testStudentSnapshot15r1_NullLastName()
        {
            Adk.SifVersion = SifVersion.SIF15r1;
            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.SIF15r1);
            String value = ss.ToXml();

            Console.WriteLine(value);

            Assertion.Assert("Last Name should be null", value.IndexOf("LastName") == -1);
        }
Exemple #4
0
        public void testStudentSnapshot20_BlankGradYear()
        {
            Adk.SifVersion = SifVersion.LATEST;
            StringMapAdaptor sma = createStudentSnapshotFields();

            // SASI Expects that a single space character 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);
        }