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()); }
public virtual void TestFormatPhysicalQuantityNull() { string result = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), new PQImpl()); // a null value for PQ elements results in a nullFlavor attribute (but not via calling getAttributeNameValuePairs, only through format() itself) Assert.AreEqual("<name nullFlavor=\"NI\"/>", result.Trim(), "map size"); Assert.IsTrue(this.result.IsValid()); }
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()); }
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"); }
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); }