Example #1
0
        public virtual void TestFormatPhysicalQuantityValid()
        {
            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;
            IDictionary <string, string> result = new PqPropertyFormatterTest.TestablePqPropertyFormatter().GetAttributeNameValuePairs
                                                      (CreateContext("PQ.BASIC"), physicalQuantity);

            Assert.AreEqual(2, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("value"), "key as expected");
            Assert.AreEqual(quantity, result.SafeGet("value"), "value");
            Assert.IsTrue(result.ContainsKey("unit"), "unit key as expected");
            Assert.AreEqual(unit.CodeValue, result.SafeGet("unit"), "unit");
        }
Example #2
0
        public virtual void TestFormatPhysicalQuantityEmpty()
        {
            IDictionary <string, string> resultMap = new PqPropertyFormatterTest.TestablePqPropertyFormatter().GetAttributeNameValuePairs
                                                         (CreateContext("PQ.BASIC"), new PhysicalQuantity());

            // an empty value for PQ elements results in a nullFlavor attribute
            Assert.AreEqual(1, resultMap.Count, "map size");
            Assert.IsTrue(resultMap.ContainsKey("nullFlavor"), "key as expected");
            Assert.AreEqual(AbstractPropertyFormatter.NULL_FLAVOR_NO_INFORMATION, resultMap.SafeGet("nullFlavor"), "value as expected"
                            );
        }