public void ParseBundleBinaryEntryXml() { var input = markupXml(testBinaryEntryAsXml); var result = FhirParser.ParseBundleEntry(FhirParser.XmlReaderFromString(input)); Assert.IsTrue(result is ResourceEntry <Binary>); Assert.IsNotNull(result); Assert.AreEqual(input, FhirSerializer.SerializeBundleEntryToXml(result)); }
private static void checkSerDeser(BundleEntry be) { var errs = new ErrorList(); FhirParser.ParseBundleEntryFromJson(FhirSerializer.SerializeBundleEntryToJson(be), errs); Assert.IsTrue(errs.Count == 0); FhirParser.ParseBundleEntryFromXml(FhirSerializer.SerializeBundleEntryToXml(be), errs); Assert.IsTrue(errs.Count == 0); }
public void SerializeBinaryEntryXml() { var re = createTestBinaryEntry(); var actual = FhirSerializer.SerializeBundleEntryToXml(re); actual = cleanupXml(actual); File.WriteAllText("c:\\temp\\bentryE.xml", testBinaryEntryAsXml); File.WriteAllText("c:\\temp\\bentryA.xml", actual); Assert.AreEqual(testBinaryEntryAsXml, actual); }
public void SerializeDeletedEntryXml() { var re = createTestDeletedEntry(); var actual = FhirSerializer.SerializeBundleEntryToXml(re); actual = cleanupXml(actual); File.WriteAllText(TempFileLocation + "dentryE.xml", testDeletedEntryAsXml); File.WriteAllText(TempFileLocation + "dentryA.xml", actual); Assert.AreEqual(testDeletedEntryAsXml, actual); }
public void ParseBundleDeletedEntryXml() { ErrorList errors = new ErrorList(); var input = markupXml(testDeletedEntryAsXml); var result = FhirParser.ParseBundleEntry(Util.XmlReaderFromString(input), errors); Assert.IsTrue(result is DeletedEntry); Assert.IsNotNull(result); Assert.AreEqual(0, errors.Count, errors.Count > 0 ? errors.ToString() : null); Assert.AreEqual(input, FhirSerializer.SerializeBundleEntryToXml(result)); }
public void SerializeAndParseFeedWithEmptyEntries() { Bundle b = new Bundle(); b.Title = "Updates to resource 233"; b.Id = new Uri("urn:uuid:0d0dcca9-23b9-4149-8619-65002224c3"); var e = new ResourceEntry <Patient>() { Id = new Uri("http://x.org/fhir/Patient/1") }; var xml = FhirSerializer.SerializeBundleEntryToXml(e); var e2 = FhirParser.ParseBundleEntryFromXml(xml); var xml2 = FhirSerializer.SerializeBundleEntryToXml(e); Assert.AreEqual(xml, xml2); }
public void QueueNewEntry(BundleEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } if (entry.Id == null) { throw new ArgumentNullException("Entry's must have a non-null Id"); } if (!entry.Id.IsAbsoluteUri) { throw new ArgumentException("Uri for new resource must be absolute"); } // Clone entry so we won't be updating our source data var newEntry = FhirParser.ParseBundleEntryFromXml(FhirSerializer.SerializeBundleEntryToXml(entry)); queue.Add(newEntry); }