Exemple #1
0
        public virtual void TestFormatPhysicalQuantitySpecificNull()
        {
            PQImpl dataType = new PQImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NOT_APPLICABLE);
            string result   = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), dataType);

            Assert.AreEqual("<name nullFlavor=\"NA\"/>", result.Trim(), "map size");
            Assert.IsTrue(this.result.IsValid());
        }
Exemple #2
0
        public virtual void TestFormatPhysicalQuantityNullMissingOriginalText()
        {
            PQImpl dataType = new PQImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NOT_APPLICABLE);
            string result   = new PqPropertyFormatterTest.TestablePqPropertyFormatter().Format(CreateContext("PQ.LAB"), dataType);

            Assert.AreEqual("<name nullFlavor=\"NA\"/>", result.Trim(), "map size");
            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
        }
Exemple #3
0
        private string CreatePeriod(PeriodicIntervalTimeR2 value, FormatContext context, int indentLevel)
        {
            PhysicalQuantity period        = value.Period;
            FormatContext    periodContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("PQ", PERIOD, context
                                                                                                                       );
            PQ periodWrapper = new PQImpl(period);

            return(this.pqFormatter.Format(periodContext, periodWrapper, indentLevel));
        }
Exemple #4
0
        public virtual void TestFormatNonNullWithEmptyPq()
        {
            PqPropertyFormatterTest.TestablePqPropertyFormatter formatter = new PqPropertyFormatterTest.TestablePqPropertyFormatter();
            PQImpl pqImpl = new PQImpl();

            pqImpl.Value = new PhysicalQuantity();
            string @string   = formatter.FormatNonNullDataTypeForTest(CreateContext("PQ.BASIC"), pqImpl, 0);
            string lineBreak = Runtime.GetProperty("line.separator");

            Assert.AreEqual("<name nullFlavor=\"NI\"/>" + lineBreak, @string);
        }
Exemple #5
0
        public virtual void TestFormatNonNullWithEmptyPq()
        {
            // nullFlavor, value, and unit are all optional in the schema (unit will default to "1")
            PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter formatter = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter
                                                                                    ();
            PQImpl pqImpl = new PQImpl();

            pqImpl.Value = new PhysicalQuantity();
            string result = formatter.FormatNonNullDataTypeForTest(CreateContext("PQ"), pqImpl, 0);

            Assert.AreEqual("<name/>", result.Trim());
        }
Exemple #6
0
        public virtual void TestFormatPhysicalQuantityNotNullWithNullFlavor()
        {
            // in this case, NF "wins"
            PhysicalQuantity pq = new PhysicalQuantity(null, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.
                                                       CENTIMETRE);
            PQImpl dataType = new PQImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NOT_APPLICABLE);

            dataType.Value = pq;
            string result = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), dataType);

            Assert.AreEqual("<name nullFlavor=\"NA\"/>", result.Trim(), "map size");
            Assert.IsTrue(this.result.IsValid());
        }
Exemple #7
0
        public virtual void TestFormatPhysicalQuantityNotNullWithNullFlavorMissingOriginalText()
        {
            PhysicalQuantity pq = new PhysicalQuantity(null, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.
                                                       CENTIMETRE);
            PQImpl dataType = new PQImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NOT_APPLICABLE);

            dataType.Value = pq;
            string result = new PqPropertyFormatterTest.TestablePqPropertyFormatter().Format(CreateContext("PQ.LAB"), dataType);

            Assert.AreEqual("<name nullFlavor=\"NA\"/>", result.Trim(), "map size");
            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(2, this.result.GetHl7Errors().Count);
        }
Exemple #8
0
        public virtual void TestFormatValidPhysicalQuantity()
        {
            string quantity = "33.45";

            Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive unit = CeRxDomainTestValues.ENZYME_UNIT_MICROMOLES_MINUTE_PER_LITRE;
            PhysicalQuantity physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Quantity = new BigDecimal(quantity);
            physicalQuantity.Unit     = unit;
            PQ     rawPq          = new PQImpl(physicalQuantity);
            string result         = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), rawPq, 0);
            string expectedResult = "<name unit=\"U/L\" value=\"33.45\"/>";

            Assert.AreEqual(expectedResult, result.Trim(), "output");
        }
Exemple #9
0
        public virtual void TestFormatValidPhysicalQuantityWithOperatorNotAllowed()
        {
            string quantity = "33.45";

            Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive unit = CeRxDomainTestValues.ENZYME_UNIT_MICROMOLES_MINUTE_PER_LITRE;
            PhysicalQuantity physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Quantity = new BigDecimal(quantity);
            physicalQuantity.Unit     = unit;
            PQ rawPq = new PQImpl(physicalQuantity);

            rawPq.Operator = SetOperator.PERIODIC_HULL;
            string result         = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), rawPq, 0);
            string expectedResult = "<name unit=\"U/L\" value=\"33.45\"/>";

            Assert.AreEqual(expectedResult, result.Trim(), "output");
            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
        }
Exemple #10
0
        public virtual void TestFormatPhysicalQuantityValidWithOriginalText()
        {
            string quantity = "33.45";

            Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive unit = CeRxDomainTestValues.ENZYME_UNIT_MICROMOLES_MINUTE_PER_LITRE;
            PhysicalQuantity physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Quantity = new BigDecimal(quantity);
            physicalQuantity.Unit     = unit;
            PQ rawPq = new PQImpl();

            rawPq.OriginalText = "some original text";
            rawPq.Value        = physicalQuantity;
            string result         = new PqPropertyFormatterTest.TestablePqPropertyFormatter().Format(CreateContext("PQ.BASIC"), rawPq, 0);
            string expectedResult = "<name unit=\"U/L\" value=\"33.45\">" + SystemUtils.LINE_SEPARATOR + "  <originalText>some original text</originalText>"
                                    + SystemUtils.LINE_SEPARATOR + "</name>" + SystemUtils.LINE_SEPARATOR;

            Assert.AreEqual(expectedResult, result, "output");
        }