public virtual void TestGetAttributeNameValuePairsNullValue() { IDictionary <string, string> result = new TestableTelUriPropertyFormatter().GetAttributeNameValuePairsForTest(CreateContext (), null, new TELImpl()); Assert.IsTrue(this.xmlResult.IsValid()); // a null value for TEL.URI elements results in a nullFlavor attribute Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey(AbstractPropertyFormatter.NULL_FLAVOR_ATTRIBUTE_NAME), "key as expected"); Assert.AreEqual(AbstractPropertyFormatter.NULL_FLAVOR_NO_INFORMATION, result.SafeGet("nullFlavor"), "value as expected"); }
public virtual void TestGetAttributeNameValuePairsTelUriValid() { TelecommunicationAddress address = new TelecommunicationAddress(); address.UrlScheme = CeRxDomainTestValues.FILE; address.Address = "value"; IDictionary <string, string> result = new TestableTelUriPropertyFormatter().GetAttributeNameValuePairsForTest(CreateContext (), address, new TELImpl()); Assert.IsTrue(this.xmlResult.IsValid()); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("file://value", result.SafeGet("value"), "value as expected"); }
public virtual void TestTelPhoneForMr2007WithValidMaxLength() { TelecommunicationAddress address = new TelecommunicationAddress(); address.UrlScheme = CeRxDomainTestValues.TELEPHONE; // tel: + 21 = 25 (max) address.Address = "123456789012345678901"; IDictionary <string, string> result = new TestableTelUriPropertyFormatter().GetAttributeNameValuePairsForTest(CreateContext ("TEL.PHONE", SpecificationVersion.V02R02), address, new TELImpl()); Assert.IsTrue(this.xmlResult.IsValid()); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("tel:" + address.Address, result.SafeGet("value"), "value as expected"); }
public virtual void TestTelEmailWithValidMaxLength() { TelecommunicationAddress address = new TelecommunicationAddress(); address.UrlScheme = CeRxDomainTestValues.MAILTO; // mailto: + 43 = 50 (max) address.Address = "1234567890123456789012345678901234567890123"; IDictionary <string, string> result = new TestableTelUriPropertyFormatter().GetAttributeNameValuePairsForTest(CreateContext ("TEL.EMAIL"), address, new TELImpl()); Assert.IsTrue(this.xmlResult.IsValid()); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("mailto:" + address.Address, result.SafeGet("value"), "value as expected"); }
public virtual void TestTelUriWithInvalidMaxLength() { TelecommunicationAddress address = new TelecommunicationAddress(); address.UrlScheme = CeRxDomainTestValues.FILE; // file:// + 249 = 256 (1 over max) address.Address = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"; IDictionary <string, string> result = new TestableTelUriPropertyFormatter().GetAttributeNameValuePairsForTest(CreateContext (), address, new TELImpl()); Assert.IsFalse(this.xmlResult.IsValid()); Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("file://" + address.Address, result.SafeGet("value"), "value as expected"); }