public void PublishLipidProfile() { var source = new FileArtifactSource(true); var profile = (Profile)source.ReadResourceArtifact(new Uri("http://from.file/TestData/lipid.profile.xml")); var publisher = new ProfileTableGenerator(@"c:\temp\publisher", "test page", false); var result = File.ReadAllText(@"TestData\publish-header.xml"); result += publisher.generate(profile, false).ToString(System.Xml.Linq.SaveOptions.DisableFormatting); result += File.ReadAllText(@"TestData\publish-footer.xml"); File.WriteAllText(@"c:\temp\publisher\publisher.html",result); }
public void PublishLipidProfile() { var source = new FileArtifactSource(true); var profile = (Profile)source.ReadResourceArtifact(new Uri("http://from.file/TestData/lipid.profile.xml")); var publisher = new ProfileTableGenerator(@"c:\temp\publisher", "test page", false); var result = File.ReadAllText(@"TestData\publish-header.xml"); result += publisher.generate(profile, false).ToString(System.Xml.Linq.SaveOptions.DisableFormatting); result += File.ReadAllText(@"TestData\publish-footer.xml"); File.WriteAllText(@"c:\temp\publisher\publisher.html", result); }
public void GetFileArtifacts() { var testPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(testPath); // Add a "user" file before preparing; File.WriteAllText(Path.Combine(testPath, "userfile.txt"), @"Hello, world"); File.WriteAllText(Path.Combine(testPath, "userfile.jrg"), @"Hello, world"); // Copy a resource from the zip to a subdirectory var resPath = Path.Combine(testPath, "resources"); Directory.CreateDirectory(resPath); Patient p = new Patient(); File.WriteAllText(Path.Combine(resPath, "patientNL.xml"), FhirSerializer.SerializeResourceToXml(p)); var fa = new FileArtifactSource(testPath, includeSubdirectories: true); fa.Mask = "*.txt | *.xml"; fa.Prepare(); // Check whether the .jrg file was indeed exluded Assert.AreEqual(2, fa.ArtifactFiles.Count()); using (var a = fa.ReadContentArtifact("userfile.txt")) { Assert.IsNotNull(a); } var pat = fa.ReadResourceArtifact(new Uri("http://nu.nl/fhir/patientNL")); Assert.IsNotNull(pat); // Check that, without a Mask, all files are found var fa2 = new FileArtifactSource(testPath, includeSubdirectories: true); Assert.AreEqual(3, fa2.ArtifactFiles.Count()); // Check that, when exluding subdirectories, we will only find 2 files again var fa3 = new FileArtifactSource(testPath, includeSubdirectories: false); Assert.AreEqual(2, fa3.ArtifactFiles.Count()); Assert.IsTrue(fa3.ArtifactFiles.All(f => f.Contains("userfile."))); }
public void PublishLipidProfileStructures() { var source = new FileArtifactSource(true); var profile = (Profile)source.ReadResourceArtifact(new Uri("http://from.file/TestData/lipid.profile.xml")); var publisher = new StructureGenerator(); foreach (var structure in profile.Structure) { var result = File.ReadAllText(@"TestData\publish-header.xml"); result += publisher.generateStructureTable("bla.html", structure, false, @"c:\temp\publisher", false, profile, "http://nu.nl/publisher.html", "publisher.html") .ToString(System.Xml.Linq.SaveOptions.DisableFormatting); result += File.ReadAllText(@"TestData\publish-footer.xml"); File.WriteAllText(@"c:\temp\publisher\" + structure.Name + ".html", result); } }