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"); }
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"); }