Beispiel #1
0
        public virtual void TestNullCase()
        {
            string result = new RtoPqPqR2PropertyFormatter().Format(GetContext("name", "RTO<PQ,PQ>"), new RTOImpl <PhysicalQuantity, PhysicalQuantity
                                                                                                                   >());

            Assert.IsTrue(this.result.IsValid());
            AssertXml("result", "<name nullFlavor=\"NI\"/>", result);
        }
Beispiel #2
0
        public virtual void TestEmptyCase()
        {
            string result = new RtoPqPqR2PropertyFormatter().Format(GetContext("name", "RTO<PQ,PQ>"), new RTOImpl <PhysicalQuantity, PhysicalQuantity
                                                                                                                   >(new Ratio <PhysicalQuantity, PhysicalQuantity>()));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().Contains("Numerator and denominator must be non-null; both are mandatory for RTO types."
                                                                              ));
            Assert.IsNotNull(result);
            AssertXml("result", "<name></name>", result);
        }
Beispiel #3
0
        public virtual void TestInvalidDenominatorZero()
        {
            Ratio <PhysicalQuantity, PhysicalQuantity> ratio = new Ratio <PhysicalQuantity, PhysicalQuantity>();

            ratio.Numerator   = new PhysicalQuantity(new BigDecimal(0), null);
            ratio.Denominator = new PhysicalQuantity(new BigDecimal(0), null);
            string result = new RtoPqPqR2PropertyFormatter().Format(GetContext("name", "RTO<PQ,PQ>"), new RTOImpl <PhysicalQuantity, PhysicalQuantity
                                                                                                                   >(ratio));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().Contains("Denominator cannot be zero for RTO types."));
            Assert.IsNotNull(result);
            AssertXml("result", "<name><numerator value=\"0\"/><denominator value=\"0\"/></name>", result);
        }
Beispiel #4
0
        public virtual void TestBasic()
        {
            Ratio <PhysicalQuantity, PhysicalQuantity> ratio = new Ratio <PhysicalQuantity, PhysicalQuantity>();

            ratio.Numerator = new PhysicalQuantity(new BigDecimal("1.00"), Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                   .MILLIGRAM);
            ratio.Denominator = new PhysicalQuantity(new BigDecimal("10.00"), Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                     .MILLILITRE);
            string result = new RtoPqPqR2PropertyFormatter().Format(GetContext("name", "RTO<PQ,PQ>"), new RTOImpl <PhysicalQuantity, PhysicalQuantity
                                                                                                                   >(ratio));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("result", "<name><numerator unit=\"mg\" value=\"1.00\"/><denominator unit=\"mL\" value=\"10.00\"/></name>", result
                      );
        }