예제 #1
0
        public void REALCastToDoubleTest()
        {
            REAL   r = new REAL(2.34f);
            double d = 2.34f;

            Assert.AreEqual(d, (double)r);
        }
예제 #2
0
        /// <summary>
        /// Parse an object from <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to parse from</param>
        /// <returns>The parsed object</returns>
        public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result)
        {
            PDVFormatter pdvFormatter = new PDVFormatter();
            REAL         retVal       = pdvFormatter.Parse <REAL>(s, result);

            // Precision is not supported in R1, but is still useful to have so
            // we will report the precision of the data that was on the wire
            string valStr = s.GetAttribute("value");

            if (valStr != null && valStr.Contains("."))
            {
                retVal.Precision = valStr.Length - valStr.IndexOf(".") - 1;
            }
            else
            {
                retVal.Precision = 0;
            }


            // Validate
            ANYFormatter fmtr     = new ANYFormatter();
            string       pathName = s is XmlStateReader ? (s as XmlStateReader).CurrentPath : s.Name;

            fmtr.Validate(retVal, pathName, result);

            return(retVal);
        }
예제 #3
0
        public void REALCastFromDoubleTest()
        {
            double d = 2.34f;
            REAL   r = d;

            Assert.AreEqual(d, (double)r);
        }
예제 #4
0
        public void REALNullFlavorTest()
        {
            REAL r = new REAL();

            r.NullFlavor = NullFlavor.NotAsked;
            r.Value      = null;
            Assert.IsTrue(r.Validate());
        }
예제 #5
0
        public void REALNullTest()
        {
            REAL r = new REAL();

            r.NullFlavor = null;
            r.Value      = null;
            Assert.IsFalse(r.Validate());
        }
예제 #6
0
        public void REALValueNullFlavorTest()
        {
            REAL r = new REAL();

            r.NullFlavor = NullFlavor.NotAsked;
            r.Value      = 123456789.0987;
            Assert.IsFalse(r.Validate());
        }
예제 #7
0
        public void R2REALBasicSerializationTest()
        {
            REAL   inti        = 8.24;
            string expectedXml = @"<test xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""8.24"" xmlns=""urn:hl7-org:v3""/>";
            var    actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
예제 #8
0
        public void REALValueTest()
        {
            REAL r = new REAL();

            r.NullFlavor = null;
            r.Value      = 123456789.0987;
            Assert.IsTrue(r.Validate());
        }
예제 #9
0
        public virtual void TestParseNoValueAttributeNode()
        {
            XmlNode node = CreateNode("<something notvalue=\"\" />");
            REAL    real = (REAL) new RealR2ElementParser().Parse(CreateContext("REAL"), node, this.xmlResult);

            Assert.IsNull(real.BareValue, "null returned");
            Assert.IsNull(real.NullFlavor, "no null flavor");
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count, "1 error");
        }
예제 #10
0
        public void R2REALBasicParseTest()
        {
            REAL inti      = 8.2358;
            var  actualXml = R2SerializationHelper.SerializeAsString(inti);
            var  int2      = R2SerializationHelper.ParseString <REAL>(actualXml);

            Assert.AreEqual(inti, int2);
            Assert.AreEqual(4, int2.Precision);
        }
예제 #11
0
 public override void Dispose()
 {
     if (!base._isDisposed)
     {
         _value = null;
         GC.SuppressFinalize(this);
         base._isDisposed = !base._isDisposed;
     }
 }
예제 #12
0
 public AdjudicatedInvoiceElementDetail()
 {
     this.id           = new SETImpl <II, Identifier>(typeof(IIImpl));
     this.code         = new CVImpl();
     this.unitQuantity = new PQImpl();
     this.unitPriceAmt = new RTOImpl <Money, PhysicalQuantity>();
     this.netAmt       = new MOImpl();
     this.factorNumber = new REALImpl();
 }
예제 #13
0
        public void R2REALUncertainRangeParseTest()
        {
            REAL inti = 8.24;

            inti.UncertainRange = new IVL <MARC.Everest.DataTypes.Interfaces.IQuantity>(new REAL(3), new REAL(5));
            var actualXml = R2SerializationHelper.SerializeAsString(inti);
            var int2      = R2SerializationHelper.ParseString <REAL>(actualXml);

            Assert.AreEqual(inti, int2);
        }
예제 #14
0
        public void R2REALUncertainRangeSerializationTest()
        {
            REAL inti = 8.24;

            inti.UncertainRange = new IVL <MARC.Everest.DataTypes.Interfaces.IQuantity>(new REAL(3), new REAL(5));
            string expectedXml = @"<test xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""8.24"" xmlns=""urn:hl7-org:v3""><uncertainRange><low value=""3"" xsi:type=""REAL""/><high value=""5"" xsi:type=""REAL""/></uncertainRange></test>";
            var    actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
예제 #15
0
 public InvoiceElementDetail()
 {
     this.id           = new IIImpl();
     this.code         = new CVImpl();
     this.netAmt       = new MOImpl();
     this.unitQuantity = new PQImpl();
     this.unitPriceAmt = new RTOImpl <Money, PhysicalQuantity>();
     this.factorNumber = new REALImpl();
     this.reasonOfBillableActChoice = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Common.Coct_mt280001ca.IA_BillableActChoice>();
 }
예제 #16
0
        public virtual void TestParseNullNode()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NI\"/>");
            REAL    real = (REAL) new RealR2ElementParser().Parse(CreateContext("REAL"), node, this.xmlResult);

            Assert.IsNull(real.Value, "null returned");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, real.NullFlavor, "null flavor"
                            );
            Assert.IsTrue(this.xmlResult.IsValid(), "no errors");
        }
예제 #17
0
        public void R2REALUncertaintySerializationTest()
        {
            REAL inti = 8.24;

            inti.Uncertainty     = new REAL(0.93);
            inti.UncertaintyType = QuantityUncertaintyType.Normal;
            string expectedXml = @"<test xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""8.24"" xmlns=""urn:hl7-org:v3"" uncertaintyType=""N""><uncertainty value=""0.93"" xsi:type=""REAL""/></test>";
            var    actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
예제 #18
0
        public void R2REALUncertaintyParseTest()
        {
            REAL inti = 8.24;

            inti.Uncertainty     = new REAL(0.93);
            inti.UncertaintyType = QuantityUncertaintyType.Normal;
            var actualXml = R2SerializationHelper.SerializeAsString(inti);
            var int2      = R2SerializationHelper.ParseString <REAL>(actualXml);

            Assert.AreEqual(inti, int2);
        }
        public void ArOpsTest01()
        {
            INT  heightCm = 180;
            INT  weightKg = 60;
            INT  bmiInt   = weightKg / (heightCm * heightCm);
            REAL bmi      = (REAL)(weightKg / (heightCm * heightCm));

            Console.WriteLine("BMI Int: " + bmiInt.ToString());
            Console.WriteLine("BMI Real: " + bmi.ToString());
            Assert.IsTrue(bmiInt.Validate());
            Assert.IsTrue(bmi.Validate());
        }
예제 #20
0
        public void R2REALNullFlavorSerializationTest()
        {
            REAL inti = 8.24;

            inti.Uncertainty     = new REAL(0.93);
            inti.UncertaintyType = QuantityUncertaintyType.Normal;
            inti.NullFlavor      = NullFlavor.PositiveInfinity;
            string expectedXml = @"<test xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" nullFlavor=""PINF"" xmlns=""urn:hl7-org:v3"" />";
            var    actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
예제 #21
0
 public ParameterList()
 {
     this.addressValue = new List <AD>();
     this.administrativeGenderValue = new CVImpl();
     this.assignedRoleTypeValue     = new List <CV>();
     this.confidenceValue           = new REALImpl();
     this.dOBValue          = new TSImpl();
     this.jurisdictionValue = new List <CV>();
     this.nameValue         = new PNImpl();
     this.providerIDValue   = new IIImpl();
     this.roleClassValue    = new List <CV>();
     this.roleTypeValue     = new List <CV>();
 }
예제 #22
0
        public void R2REALExpressionParseTest()
        {
            REAL inti = 8.24;

            inti.Uncertainty     = new REAL(0.93);
            inti.UncertaintyType = QuantityUncertaintyType.Normal;
            inti.Expression      = new ED(
                System.Text.Encoding.UTF8.GetBytes("i = (10 + 2) / 2 + 2)"),
                "application/mathml+xml"
                );
            var actualXml = R2SerializationHelper.SerializeAsString(inti);
            var int2      = R2SerializationHelper.ParseString <REAL>(actualXml);

            Assert.AreEqual(inti, int2);
        }
예제 #23
0
        public void R2REALExpressionSerializationTest()
        {
            REAL inti = 8.24;

            inti.Uncertainty     = new REAL(0.93);
            inti.UncertaintyType = QuantityUncertaintyType.Normal;
            inti.Expression      = new ED(
                System.Text.Encoding.UTF8.GetBytes("i = (10 + 2) / 2 + 2)"),
                "application/mathml+xml"
                );
            string expectedXml = @"<test xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""8.24"" xmlns=""urn:hl7-org:v3"" uncertaintyType=""N""><expression mediaType=""application/mathml+xml""><data>aSA9ICgxMCArIDIpIC8gMiArIDIp</data></expression><uncertainty value=""0.93"" xsi:type=""REAL""/></test>";
            var    actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
예제 #24
0
        public void EV_1088_REALToStringLocalizationTest()
        {
            // Setup
            var defaultCulture = EverestFrameworkContext.CurrentCulture;

            EverestFrameworkContext.CurrentCulture = new System.Globalization.CultureInfo("fr-FR", false);

            // Graph
            REAL test = new REAL(1.20f);

            test.Precision = 2;
            Assert.IsTrue(test.ToString().StartsWith("1,20"));
            // Teardown
            EverestFrameworkContext.CurrentCulture = defaultCulture;
        }
예제 #25
0
        /// <summary>
        /// Graph <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to graph to</param>
        /// <param name="o">The object to graph</param>
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            // We don't use base.graph() here because we want to control the value property
            ANYFormatter baseFormatter = new ANYFormatter();

            baseFormatter.Graph(s, o, result);
            REAL instance = o as REAL;

            if (instance.NullFlavor != null)
            {
                return;                              // Don't graph anymore
            }
            // Precision
            if (instance.Value.HasValue && instance.Precision != 0)
            {
                s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision), DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator), DatatypeFormatter.FormatterCulture));
            }
            else if (instance.Value.HasValue)
            {
                s.WriteAttributeString("value", instance.Value.Value.ToString(DatatypeFormatter.FormatterCulture));
            }

            // Unsupported properties
            if (instance.Expression != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "REAL", s.ToString()));
            }
            if (instance.OriginalText != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "REAL", s.ToString()));
            }
            if (instance.Uncertainty != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "REAL", s.ToString()));
            }
            if (instance.UncertaintyType != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "REAL", s.ToString()));
            }
            if (instance.UncertainRange != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "REAL", s.ToString()));
            }
        }
예제 #26
0
        /// <summary>
        /// Graph <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to graph to</param>
        /// <param name="o">The object to graph</param>
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            ANYFormatter baseFormatter = new ANYFormatter();

            baseFormatter.Graph(s, o, result);
            REAL instance = o as REAL;

            if (instance.NullFlavor != null)
            {
                return;                              // Don't graph anymore
            }
            // Precision
            if (instance.Value.HasValue && instance.Precision != 0)
            {
                s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision))));
            }
            else if (instance.Value.HasValue)
            {
                s.WriteAttributeString("value", instance.Value.Value.ToString());
            }

            // Unsupported properties
            if (instance.Expression != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "REAL", s.ToString()));
            }
            if (instance.OriginalText != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "REAL", s.ToString()));
            }
            if (instance.Uncertainty != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "REAL", s.ToString()));
            }
            if (instance.UncertaintyType != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "REAL", s.ToString()));
            }
            if (instance.UncertainRange != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "REAL", s.ToString()));
            }
        }
예제 #27
0
        public RealMemories(string Code, int Size)
        {
            if (Size < 1)
            {
                throw new Exception("Size는 1이상");
            }
            if (!Regex.IsMatch(Code.ToString(), "[a-zA-Z]", RegexOptions.IgnoreCase))
            {
                throw new Exception("Code는 알파벳으로");
            }

            this.RawData = new byte[Size * 4];
            this.Code    = Code.ToUpper();

            R = new REAL[Size];
            for (int i = 0; i < R.Length; i++)
            {
                R[i] = new REAL(this, i * 4);
            }
        }
예제 #28
0
 public ParameterList()
 {
     this.addressValue = new List <AD>();
     this.administrativeGenderValue = new CVImpl();
     this.assignedRoleTypeValue     = new List <CV>();
     this.confidenceValue           = new REALImpl();
     this.dOBValue = new TSImpl();
     this.includeHistoryIndicatorValue = new BLImpl();
     this.jurisdictionValue            = new List <CV>();
     this.nameValue              = new PNImpl();
     this.providerIDValue        = new List <II>();
     this.qualificationValue     = new List <CV>();
     this.responseObject         = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2007_v02_r02.Pr.Prpm_mt306010ca.ResponseObject>();
     this.roleClassValue         = new List <CV>();
     this.roleEffectiveDateValue = new IVLImpl <TS, Interval <PlatformDate> >();
     this.roleTypeValue          = new List <CV>();
     this.routedDocTypeValue     = new CVImpl();
     this.serviceDeliveryLocationAddressValue = new List <AD>();
     this.serviceDeliveryLocationIDValue      = new List <II>();
     this.serviceDeliveryLocationTypeValue    = new List <CV>();
     this.statusValue  = new List <CV>();
     this.telecomValue = new List <TEL>();
 }
예제 #29
0
        /// <summary>
        /// Parse an object from <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to parse from</param>
        /// <returns>The parsed object</returns>
        public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result)
        {
            REAL retVal = base.Parse <REAL>(s, result);

            // Precision is not supported in R1, but is still useful to have so
            // we will report the precision of the data that was on the wire
            string valStr = s.GetAttribute("value");

            if (valStr != null && valStr.Contains(DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator))
            {
                retVal.Precision = valStr.Length - valStr.IndexOf(DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator) - 1;
            }
            else
            {
                retVal.Precision = 0;
            }


            // Validate
            base.Validate(retVal, s.ToString(), result);

            return(retVal);
        }
예제 #30
0
        public RealMemories(string Code, byte[] RawData)
        {
            if (RawData == null)
            {
                throw new Exception("RawData는 null일 수 없음");
            }
            if (RawData.Length % 2 != 0)
            {
                throw new Exception("RawData의 크기는 4의 배수이어야 함");
            }
            if (!Regex.IsMatch(Code.ToString(), "[a-zA-Z]", RegexOptions.IgnoreCase))
            {
                throw new Exception("Code는 알파벳으로");
            }

            this.RawData = RawData;
            this.Code    = Code.ToUpper();

            R = new REAL[Size];
            for (int i = 0; i < R.Length; i++)
            {
                R[i] = new REAL(this, i * 4);
            }
        }
예제 #31
0
파일: EV-1088.cs 프로젝트: oneminot/everest
        public void EV_1088_REALToStringLocalizationTest()
        {
            // Setup
            var defaultCulture = EverestFrameworkContext.CurrentCulture;
            EverestFrameworkContext.CurrentCulture = new System.Globalization.CultureInfo("fr-FR", false);

            // Graph 
            REAL test = new REAL(1.20f);
            test.Precision = 2;
            Assert.IsTrue(test.ToString().StartsWith("1,20"));
            // Teardown
            EverestFrameworkContext.CurrentCulture = defaultCulture;
        }
예제 #32
0
 public void REALNullFlavorTest()
 {
     REAL r = new REAL();
     r.NullFlavor = NullFlavor.NotAsked;
     r.Value = null;
     Assert.IsTrue(r.Validate());
 }
예제 #33
0
 public void REALCastToDoubleTest()
 {
     REAL r = new REAL(2.34f);
     double d = 2.34f;
     Assert.AreEqual(d, (double)r);      
 }
예제 #34
0
 public void REALValueNullFlavorTest()
 {
     REAL r = new REAL();
     r.NullFlavor = NullFlavor.NotAsked;
     r.Value = 123456789.0987; 
     Assert.IsFalse(r.Validate());
 }
예제 #35
0
 public void REALNullTest()
 {
     REAL r = new REAL();
     r.NullFlavor = null;
     r.Value = null;
     Assert.IsFalse(r.Validate());
 }
예제 #36
0
 public void REALValueTest()
 {
     REAL r = new REAL();
     r.NullFlavor = null;
     r.Value = 123456789.0987; 
     Assert.IsTrue(r.Validate());
 }