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:"); } }
private void RunVersioningTests(SifVersion dataVersion, SifVersion schemaVersion, bool ignoreEnumerationErrors) { // Tests assume that the schema files are embedded in the test assembly DirectoryInfo workingDirectory = new DirectoryInfo(Environment.CurrentDirectory); SchemaValidator sv = USSchemaValidator.NewInstance(schemaVersion); sv.IgnoreEnumerationErrors = ignoreEnumerationErrors; String dataVersionStr = getShortenedVersion(dataVersion); // Warning, slight hack. Move up two directories to the project root // directory (assumes the project directory is still there) // This assumption will need to be changed if the tests need to become more portable workingDirectory = workingDirectory.Parent.Parent; DirectoryInfo dataDir = new DirectoryInfo(workingDirectory.FullName + "\\data\\" + dataVersionStr); int errorCount = RunDirectoryTest(dataVersion, schemaVersion, dataDir, Console.Out, sv); Assert.AreEqual(0, errorCount, "Tests Failed. See System.out for details"); }