public void TestSerializeSurveyFile() { S3Root s3 = GetS3Survey(); string filename = "example1.xml"; S3Serializer.ToFile(filename, s3); var s3Import = S3Serializer.FromFile(filename); Assert.AreEqual("A", s3Import.Survey.Record.ID); }
private void OnExecute() { var subject = TripleSFilename; if (string.IsNullOrEmpty(TripleSFilename)) { Console.WriteLine($"Must specify a valid Triple-S file"); Console.ReadLine(); return; } try { var data = S3Serializer.FromFile(TripleSFilename); Console.WriteLine(data.Survey.Name); Console.WriteLine(data.Survey.Version); Console.WriteLine(data.Survey.Title.GetText()); var record = data.Survey.Record; foreach (var s3var in record.Variables) { var error = S3Validator.ValidateVariable(s3var); if (!string.IsNullOrEmpty(error)) { Console.WriteLine(s3var.Name + " " + s3var.Label.GetText()); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(error); Console.ResetColor(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } //Console.ReadLine(); }