Example #1
0
        public virtual void TestGetAttributeNameValuePairsForII_BUS_AND_VER_InvalidSpecializationType()
        {
            Identifier ii    = new Identifier("11.22.33.44", "extensionString");
            II         iiHl7 = new IIImpl();

            iiHl7.DataType = StandardDataType.II_OID;
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.BUS_AND_VER", null, null, false, SpecificationVersion.R02_04_02, null, null, null,
                                                                                                false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(5, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty(), "errors");
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count);
            Assert.AreEqual("Specialization type must be II.BUS or II.VER; II.BUS will be assumed. Invalid specialization type II.OID"
                            , modelToXmlResult.GetHl7Errors()[0].GetMessage());
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
            AssertKeyValuePairInMap(result, "extension", "extensionString");
            AssertKeyValuePairInMap(result, "use", "BUS");
            AssertKeyValuePairInMap(result, "specializationType", "II.BUS");
            AssertKeyValuePairInMap(result, "xsi:type", "II");
        }
Example #2
0
        public virtual void TestGetAttributeNameValuePairsExtensionNotFilled()
        {
            Identifier ii = new Identifier("11.22.33.44", null);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(new ModelToXmlResult(), null, "name", null, null
                                                                                                                                 , null, false), ii, new IIImpl(ii));

            Assert.AreEqual(1, result.Count, "map size");
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
            AssertKeyNotInMap(result, "extension");
        }
Example #3
0
        public virtual void TestGetAttributeNameValuePairsAllFilledInExcludingSpecializationTypeForAB()
        {
            Identifier ii    = new Identifier("11.22.33.44", "extensionString");
            II         iiHl7 = new IIImpl();

            iiHl7.DataType = StandardDataType.II;
            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (new ModelToXmlResult(), null, "name", "II", null, null, true, SpecificationVersion.V02R02_AB, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(2, result.Count, "map size");
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
            AssertKeyValuePairInMap(result, "extension", "extensionString");
        }
Example #4
0
        public virtual void TestGetAttributeNameValuePairsForValidII_OID_MR2007()
        {
            Identifier       ii               = new Identifier("11.22.33.44");
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.OID", null, null, false, SpecificationVersion.V02R02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(modelToXmlResult.GetHl7Errors().IsEmpty(), "no errors");
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
        }
Example #5
0
        public virtual void TestGetAttributeNameValuePairsForValidII_VER()
        {
            UUID             randomUUID       = UUID.RandomUUID();
            Identifier       ii               = new Identifier(randomUUID.ToString());
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.VER", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(2, result.Count, "map size");
            Assert.IsTrue(modelToXmlResult.GetHl7Errors().IsEmpty(), "no errors");
            AssertKeyValuePairInMap(result, "root", randomUUID.ToString());
            AssertKeyValuePairInMap(result, "use", "VER");
        }
Example #6
0
        public virtual void TestGetAttributeNameValuePairsForInvalidII_TOKEN()
        {
            Identifier       ii               = new Identifier("1.2.3.4");
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.TOKEN", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty());
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count);
            Assert.AreEqual("root '1.2.3.4' should be a UUID.", modelToXmlResult.GetHl7Errors()[0].GetMessage());
            AssertKeyValuePairInMap(result, "root", "1.2.3.4");
        }
Example #7
0
        public virtual void TestGetAttributeNameValuePairsAllFilledInForIiPublicInMr2009()
        {
            Identifier ii    = new Identifier("11.22.33.44", "extensionString");
            II         iiHl7 = new IIImpl();

            iiHl7.DataType = StandardDataType.II_PUBLIC;
            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (new ModelToXmlResult(), null, "name", "II.PUBLIC", null, null, true, SpecificationVersion.R02_04_03, null, null, null,
                                                                                                false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(4, result.Count, "map size");
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
            AssertKeyValuePairInMap(result, "extension", "extensionString");
            AssertKeyValuePairInMap(result, "displayable", "true");
            AssertKeyValuePairInMap(result, "use", "BUS");
        }
Example #8
0
        public virtual void TestGetAttributeNameValuePairsForInvalidII_OID_shouldNotHaveExtension()
        {
            Identifier       ii               = new Identifier("11.22.33.44", "shouldNotBeHere");
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.OID", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(3, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty());
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count);
            Assert.AreEqual("Attribute \"extension\" is not allowed for II.OID", modelToXmlResult.GetHl7Errors()[0].GetMessage());
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
            AssertKeyValuePairInMap(result, "extension", "shouldNotBeHere");
            AssertKeyValuePairInMap(result, "use", "BUS");
        }
Example #9
0
        public virtual void TestGetAttributeNameValuePairsForInvalidII_OID()
        {
            UUID             randomUUID       = UUID.RandomUUID();
            Identifier       ii               = new Identifier(randomUUID.ToString());
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.OID", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(2, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty());
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count);
            Assert.AreEqual("The oid, \"" + randomUUID.ToString() + "\" does not appear to be a valid oid", modelToXmlResult.GetHl7Errors
                                ()[0].GetMessage());
            AssertKeyValuePairInMap(result, "root", randomUUID.ToString());
            AssertKeyValuePairInMap(result, "use", "BUS");
        }
Example #10
0
        public virtual void TestGetAttributeNameValuePairsForInvalidII_OID_rootTooLong()
        {
            string           tooLongRoot      = "12345678900.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789";
            Identifier       ii               = new Identifier(tooLongRoot);
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.OID", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(2, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty());
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count);
            Assert.AreEqual("root '" + tooLongRoot + "' exceeds maximum allowed length of 200.", modelToXmlResult.GetHl7Errors()[0].GetMessage
                                ());
            AssertKeyValuePairInMap(result, "root", tooLongRoot);
            AssertKeyValuePairInMap(result, "use", "BUS");
        }
Example #11
0
        public virtual void TestGetAttributeNameValuePairsForInvalidII_PUBLIC()
        {
            Identifier       ii               = new Identifier("11.22.33.44", "extensionStrngTooLong");
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.PUBLIC", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false
                                                                                                );
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(4, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty(), "errors");
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count);
            Assert.AreEqual("extension 'extensionStrngTooLong' exceeds maximum allowed length of 20.", modelToXmlResult.GetHl7Errors(
                                )[0].GetMessage());
            AssertKeyValuePairInMap(result, "root", "11.22.33.44");
            AssertKeyValuePairInMap(result, "extension", "extensionStrngTooLong");
            AssertKeyValuePairInMap(result, "use", "BUS");
            AssertKeyValuePairInMap(result, "displayable", "true");
        }
Example #12
0
        public virtual void TestGetAttributeNameValuePairsForValidII_BUSforCerxWithInvalidRoot()
        {
            Identifier ii = new Identifier("123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1"
                                           , "extensionString");
            II iiHl7 = new IIImpl();

            iiHl7.DataType = StandardDataType.II_BUS;
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.BUS", null, null, false, SpecificationVersion.V01R04_3, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(3, result.Count, "map size");
            Assert.IsFalse(modelToXmlResult.GetHl7Errors().IsEmpty(), "1 error");
            Assert.AreEqual(1, modelToXmlResult.GetHl7Errors().Count, "1 error");
            Assert.IsTrue(modelToXmlResult.GetHl7Errors()[0].GetMessage().Contains("200"));
            AssertKeyValuePairInMap(result, "root", "123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1"
                                    );
            AssertKeyValuePairInMap(result, "extension", "extensionString");
            AssertKeyValuePairInMap(result, "use", "BUS");
        }