public virtual void TestSxcmNoOperator() { string integerValue = "123"; Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "SXCM<INT>", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.REQUIRED, null, false); INTImpl dataType = new INTImpl(System.Convert.ToInt32(integerValue)); string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, dataType); Assert.AreEqual("<name value=\"123\"/>", output.Trim(), "xml output as expected"); Assert.IsTrue(context.GetModelToXmlResult().IsValid()); }
public virtual void TestGetAttributeNameValuePairsIntegerZeroNoWarnings() { string integerValue = "0"; Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "INT", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.REQUIRED, null, false); string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, new INTImpl(System.Convert.ToInt32 (integerValue))); Assert.AreEqual("<name value=\"0\"/>", output.Trim(), "xml output as expected"); Assert.IsTrue(context.GetModelToXmlResult().IsValid(), "no errors"); }
public virtual void TestIntegerOperatorNotAllowed() { string integerValue = "123"; Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "INT", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.REQUIRED, null, false); INTImpl dataType = new INTImpl(System.Convert.ToInt32(integerValue)); dataType.Operator = SetOperator.INCLUDE; string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, dataType); Assert.AreEqual("<name value=\"123\"/>", output.Trim(), "xml output as expected"); Assert.IsFalse(context.GetModelToXmlResult().IsValid()); Assert.AreEqual(1, context.GetModelToXmlResult().GetHl7Errors().Count); }
public virtual void TestGetAttributeNameValuePairsIntegerNegative() { string integerValue = "-1"; Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "INT", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.REQUIRED, null, false); Int32?integer = System.Convert.ToInt32(integerValue); IDictionary <string, string> result = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().GetAttributeNameValuePairsForTest (context, integer, new INTImpl(integer)); Assert.AreEqual(1, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual(integerValue, result.SafeGet("value"), "value as expected"); context.GetModelToXmlResult().ClearErrors(); string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, new INTImpl(integer)); Assert.AreEqual("<name value=\"-1\"/>", output.Trim(), "xml output as expected"); Assert.IsTrue(context.GetModelToXmlResult().IsValid()); }