private void WriteReference(EncapsulatedData encapsulatedData, StringBuilder buffer, int indentLevel, FormatContext context ) { if (encapsulatedData.ReferenceObj != null) { TEL tel = new TELImpl(encapsulatedData.ReferenceObj); FormatContext newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(isR2 ? "TEL" : "TEL.URI" , "reference", context); string formattedReference = this.telFormatter.Format(newContext, tel, indentLevel); if (StringUtils.IsNotBlank(formattedReference)) { buffer.Append(formattedReference); } } }
public virtual void TestGetAttributeNameValuePairsTelPhonemailWithSpecializationType() { TelecommunicationAddress address = new TelecommunicationAddress(); address.UrlScheme = CeRxDomainTestValues.TELEPHONE; address.Address = "value"; TELImpl bareAny = new TELImpl(); bareAny.DataType = StandardDataType.TEL_PHONE; IDictionary <string, string> result = new TelPhonemailPropertyFormatterTest.TestableTelPhonemailPropertyFormatter().GetAttributeNameValuePairsForTest (CreateContext("TEL.PHONEMAIL"), address, bareAny); Assert.IsTrue(this.xmlResult.IsValid()); Assert.AreEqual(3, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("tel:value", result.SafeGet("value"), "value as expected"); Assert.IsTrue(result.ContainsKey("specializationType"), "key as expected"); Assert.AreEqual("TEL.PHONE", result.SafeGet("specializationType"), "value as expected"); Assert.IsTrue(result.ContainsKey("xsi:type"), "key as expected"); Assert.AreEqual("TEL", result.SafeGet("xsi:type"), "value as expected"); }
public virtual void TestGetAttributeNameValuePairsTelPhonemailMissingSpecializationType2() { TelecommunicationAddress address = new TelecommunicationAddress(); address.UrlScheme = CeRxDomainTestValues.TELEPHONE; address.Address = "value"; TELImpl bareAny = new TELImpl(); bareAny.DataType = null; IDictionary <string, string> result = new TelPhonemailPropertyFormatterTest.TestableTelPhonemailPropertyFormatter().GetAttributeNameValuePairsForTest (CreateContext("TEL.PHONEMAIL"), address, bareAny); Assert.IsFalse(this.xmlResult.IsValid()); Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count); Assert.AreEqual(3, result.Count, "map size"); // ST and xsi:type are provided after detecting invalid/missing ST Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("tel:value", result.SafeGet("value"), "value as expected"); Assert.IsTrue(result.ContainsKey("specializationType"), "key as expected"); Assert.AreEqual("TEL.PHONE", result.SafeGet("specializationType"), "value as expected"); Assert.IsTrue(result.ContainsKey("xsi:type"), "key as expected"); Assert.AreEqual("TEL", result.SafeGet("xsi:type"), "value as expected"); }