示例#1
0
        public virtual void TestFormatPhysicalQuantityNull()
        {
            string formatResult = new PqPropertyFormatter().Format(CreateContext(), new PQImpl());

            // a null value for PQ elements results in a nullFlavor attribute
            Assert.AreEqual("<name nullFlavor=\"NI\"/>", formatResult.Trim(), "result");
        }
示例#2
0
        public virtual void TestFormatPhysicalQuantityValueOrUnitNull()
        {
            // no name-value pairs
            PqPropertyFormatter formatter        = new PqPropertyFormatter();
            PhysicalQuantity    physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Unit = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.MILLIGRAM;
            formatter.Format(CreateContext(), new PQImpl(physicalQuantity));
            Assert.AreEqual("No value provided for physical quantity", this.result.GetHl7Errors()[0].GetMessage());
        }
示例#3
0
        public virtual void TestFormatPhysicalQuantityEmpty()
        {
            IDictionary <string, string> result = new PqPropertyFormatter().GetAttributeNameValuePairs(CreateContext(), new PhysicalQuantity
                                                                                                           ());

            // an empty value for PQ 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");
        }
示例#4
0
        public virtual void TestFormatPhysicalQuantityValid()
        {
            string quantity = "33.45";

            Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive unit = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                                     .MILLILITRE;
            PhysicalQuantity physicalQuantity = new PhysicalQuantity();

            physicalQuantity.Quantity = new BigDecimal(quantity);
            physicalQuantity.Unit     = unit;
            IDictionary <string, string> result = new PqPropertyFormatter().GetAttributeNameValuePairs(CreateContext(), 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");
        }