示例#1
0
        public virtual void TestParseValueAttributeValidWithDefaultOperator()
        {
            XmlNode node  = CreateNode("<something value=\"1234.45\" unit=\"kg\" />");
            BareANY pqAny = new PqR2ElementParser().Parse(CreateContext("SXCM<PQ>", SpecificationVersion.V02R02), node, this.xmlResult
                                                          );
            PhysicalQuantity physicalQuantity = (PhysicalQuantity)pqAny.BareValue;

            Assert.AreEqual(new BigDecimal("1234.45"), physicalQuantity.Quantity, "quantity");
            Assert.AreEqual(CeRxDomainTestValues.KILOGRAM.CodeValue, physicalQuantity.Unit.CodeValue, "unit");
            Assert.IsTrue(this.xmlResult.IsValid(), "no errors");
            Assert.AreEqual(SetOperator.INCLUDE, ((ANYMetaData)pqAny).Operator, "operator");
        }
示例#2
0
        public virtual void TestParseValueAttributeValidWithOperatorNotAllowed()
        {
            XmlNode          node             = CreateNode("<something operator=\"P\" value=\"1234.45\" unit=\"kg\" />");
            BareANY          pqAny            = new PqR2ElementParser().Parse(CreateContext("PQ", SpecificationVersion.V02R02), node, this.xmlResult);
            PhysicalQuantity physicalQuantity = (PhysicalQuantity)pqAny.BareValue;

            Assert.AreEqual(new BigDecimal("1234.45"), physicalQuantity.Quantity, "quantity");
            Assert.AreEqual(CeRxDomainTestValues.KILOGRAM.CodeValue, physicalQuantity.Unit.CodeValue, "unit");
            Assert.IsNull(((ANYMetaData)pqAny).Operator, "no operator");
            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count, "1 error expected");
        }