public virtual void TestGetAttributeNameValuePairsNullValue() { ModelToXmlResult xmlResult = new ModelToXmlResult(); IDictionary <string, string> result = new TsFullDatePropertyFormatterTest.TestableTsFullDatePropertyFormatter().GetAttributeNameValuePairsForTest (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(xmlResult, null, "name", null, null, null, false ), null, new TSImpl()); // a null value for TS elements results in a nullFlavor attribute Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("nullFlavor"), "key as expected"); Assert.AreEqual(AbstractPropertyFormatter.NULL_FLAVOR_NO_INFORMATION, result.SafeGet("nullFlavor"), "value as expected"); Assert.IsTrue(xmlResult.GetHl7Errors().IsEmpty()); }
public virtual void TestGetAttributeNameValuePairsDate() { // used as expected: a date object is passed in PlatformDate calendar = DateUtil.GetDate(1999, 3, 23, 10, 11, 12, 0); ModelToXmlResult xmlResult = new ModelToXmlResult(); IDictionary <string, string> result = new TsFullDatePropertyFormatterTest.TestableTsFullDatePropertyFormatter().GetAttributeNameValuePairsForTest (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(xmlResult, null, "name", "TS.DATE", null, null , false, SpecificationVersion.R02_04_02, null, null, null, false), calendar, null); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("19990423", result.SafeGet("value"), "value as expected"); Assert.IsTrue(xmlResult.GetHl7Errors().IsEmpty()); }
public virtual void TestGetAttributeNameValuePairsForDateWithPattern() { // used as expected: a date object is passed in PlatformDate calendar = DateUtil.GetDate(1999, 3, 23, 10, 11, 12, 0); DateWithPattern dateWithPattern = new DateWithPattern(calendar, "yyyyMM"); // note that a Date and a DateWithPattern only work for equals() because the // Java implementation we are using uses "instanceof" instead of "getClass()" for its preliminary comparison Assert.AreEqual(calendar, dateWithPattern, "same dates should be equal"); ModelToXmlResult xmlResult = new ModelToXmlResult(); IDictionary <string, string> result = new TsFullDatePropertyFormatterTest.TestableTsFullDatePropertyFormatter().GetAttributeNameValuePairsForTest (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(xmlResult, null, "name", "TS.DATE", null, null , false, SpecificationVersion.R02_04_02, null, null, null, false), dateWithPattern, null); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual("199904", result.SafeGet("value"), "value as expected"); Assert.IsTrue(xmlResult.GetHl7Errors().IsEmpty()); }