public virtual void TestParse() { XmlNode node = CreateNode("<top xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" " + "xmlns:cda=\"urn:hl7-org:v3\" xmlns:sdtc=\"urn:hl7-org:sdtc\">" + "<effectiveTime xsi:type=\"IVL_TS\"><low value=\"20120512\"/><high value=\"20120512\"/></effectiveTime>" + "<effectiveTime xsi:type=\"PIVL_TS\" institutionSpecified=\"true\" operator=\"A\"><period value=\"1\" unit=\"h\"/></effectiveTime>" + "</top>"); ParseContext parseContext = ParseContextImpl.Create("LIST<SXCM<TS>>", null, SpecificationVersion.CCDA_R1_1, null, null, null , Cardinality.Create("0-4"), null, true); BareANY result = new ListR2ElementParser(this.parserR2Registry).Parse(parseContext, AsList(node.ChildNodes), this.xmlResult ); Assert.IsTrue(this.xmlResult.IsValid()); IList <MbDate> list = ((LIST <SXCM_R2 <MbDate>, MbDate>)result).RawList(); Assert.IsNotNull(list, "null"); Assert.AreEqual(2, list.Count, "size"); DateInterval firstValue = (DateInterval)list[0]; AssertDateEquals("low", "yyyyMMdd", ParseDate("2012-05-12"), firstValue.Interval.Low); AssertDateEquals("high", "yyyyMMdd", ParseDate("2012-05-12"), firstValue.Interval.High); PeriodicIntervalTimeR2 secondValue = (PeriodicIntervalTimeR2)list[1]; Assert.AreEqual(true, secondValue.InstitutionSpecified); Assert.AreEqual(new BigDecimal("1"), secondValue.Period.Quantity); Assert.AreEqual("h", secondValue.Period.Unit.CodeValue); }
public virtual void TestParse() { XmlNode node = CreateNode("<top>" + "<targetSiteCode code=\"416949008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Abdomen and pelvis\"/>" + "</top>"); Type expectedReturnType = typeof(ObservationValue); ParseContext parseContext = ParseContextImpl.Create("LIST<CD>", expectedReturnType, SpecificationVersion.CCDA_R1_1, null, null, null, Cardinality.Create("0-4"), null, true); BareANY result = new ListR2ElementParser(this.parserR2Registry).Parse(parseContext, AsList(node.ChildNodes), this.xmlResult ); Assert.IsTrue(this.xmlResult.IsValid()); IList <CodedTypeR2 <ObservationValue> > list = ((LIST <CD_R2 <ObservationValue>, CodedTypeR2 <ObservationValue> >)result).RawList (); Assert.IsNotNull(list, "null"); Assert.AreEqual(1, list.Count, "size"); CodedTypeR2 <ObservationValue> firstValue = list[0]; Assert.AreEqual("416949008", firstValue.GetCodeValue()); Assert.AreEqual("2.16.840.1.113883.6.96", firstValue.GetCodeSystem()); Assert.AreEqual("SNOMED CT", firstValue.CodeSystemName); Assert.AreEqual("Abdomen and pelvis", firstValue.DisplayName); }