Beispiel #1
0
        public virtual void TestCastDateIntervalCorrectType()
        {
            object expected = new Interval <PlatformDate>(new PlatformDate(), SetOperator.CONVEX_HULL);
            object actual   = GenericClassUtil.CastBareValueAsIntervalDate(expected);

            Assert.AreSame(expected, actual);
        }
Beispiel #2
0
        private BareANY ConvertDataType(BareANY dataType)
        {
            object bareValue = dataType.BareValue;
            Interval <PlatformDate> ivlTsR1 = GenericClassUtil.CastBareValueAsIntervalDate(bareValue);
            DateInterval            ivlTsR2 = (ivlTsR1 == null ? null : ConvertIvlTs(ivlTsR1));
            IVLTSCDAR1 result = new IVLTSCDAR1Impl();

            result.DataType   = dataType.DataType;
            result.BareValue  = ivlTsR2;
            result.NullFlavor = dataType.NullFlavor;
            return(result);
        }
Beispiel #3
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        public virtual BareANY Parse(ParseContext context, IList <XmlNode> nodes, XmlToModelResult xmlToModelResult)
        {
            BareANY parsedValue = actualIvlTsParser.Parse(context, nodes, xmlToModelResult);
            // need to wrap result in a DateInterval
            object bareValue = parsedValue.BareValue;
            Interval <PlatformDate> interval = GenericClassUtil.CastBareValueAsIntervalDate(bareValue);

            if (interval != null)
            {
                DateInterval newValue = new DateInterval(interval);
                XmlNode      node     = (nodes == null || nodes.Count == 0 ? null : nodes[0]);
                // should always have a node
                HandleConstraints(context, xmlToModelResult, (XmlElement)node, newValue);
                //Have to create a new value since .NET won't allow re-assign of BareValue
                return(createNewParsedValue((IVLImpl <QTY <PlatformDate>, Interval <PlatformDate> >)parsedValue, newValue));
            }
            return(parsedValue);
        }
Beispiel #4
0
 public virtual void TestCastDateIntervalWrongType()
 {
     Assert.IsNull(GenericClassUtil.CastBareValueAsIntervalDate("abcd"));
     Assert.IsNull(GenericClassUtil.CastBareValueAsIntervalDate(new Interval <string>("abcd", SetOperator.CONVEX_HULL)));
 }