Ejemplo n.º 1
0
        public virtual void TestWrapperNull()
        {
            IVL_TSImpl hl7DataType = null;
            string     result      = new IvlTsR2PropertyFormatter().Format(GetContext("name"), hl7DataType);

            Assert.AreEqual(string.Empty, result);
        }
Ejemplo n.º 2
0
        public virtual void TestAdaptValueDateInterval()
        {
            IVL_TSImpl original = new IVL_TSImpl();

            original.Value       = new DateInterval();
            original.NullFlavor  = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION;
            original.DataType    = StandardDataType.IVL_TS;
            original.Language    = "Fr";
            original.DisplayName = "Display Name";
            original.Translations.Add(new CDImpl(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP));
            original.Translations.Add(new CDImpl(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.GALLON));
            original.OriginalText = "Original Text";
            original.IsCdata      = false;
            original.Unsorted     = true;
            original.Operator     = SetOperator.CONVEX_HULL;

            BareANY adaptedValue = GenericClassUtil.AdaptValue(original);

            Assert.IsTrue(adaptedValue is SXCM_R2Impl <MbDate>);

            SXCM_R2Impl <MbDate> actualValue = (SXCM_R2Impl <MbDate>)adaptedValue;

            Assert.AreSame(original.Value, actualValue.Value);
            Assert.AreSame(original.NullFlavor, actualValue.NullFlavor);
            Assert.AreSame(original.DataType, actualValue.DataType);
            Assert.AreSame(original.Language, actualValue.Language);
            Assert.AreSame(original.DisplayName, actualValue.DisplayName);
            Assert.AreSame(original.OriginalText, actualValue.OriginalText);
            Assert.AreEqual(original.IsCdata, actualValue.IsCdata);
            Assert.AreEqual(original.Unsorted, actualValue.Unsorted);
            Assert.AreEqual(original.Operator, actualValue.Operator);
            AssertTranslations(original.Translations, actualValue.Translations);
        }
Ejemplo n.º 3
0
        private string CreatePhase(PeriodicIntervalTimeR2 value, FormatContext context, int indentLevel)
        {
            Interval <PlatformDate> phase = value.Phase;
            IVL_TS        phaseWrapper    = new IVL_TSImpl(phase == null ? null : new DateInterval(phase));
            FormatContext phaseContext    = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("IVL<TS>", PHASE,
                                                                                                                      context);

            return(this.ivlTsFormatter.Format(phaseContext, phaseWrapper, indentLevel));
        }
Ejemplo n.º 4
0
        public virtual void TestIntervalNull()
        {
            DateInterval dateInterval = null;
            IVL_TSImpl   hl7DataType  = new IVL_TSImpl(dateInterval);

            hl7DataType.DataType = StandardDataType.IVL_TS;
            string result = new IvlTsR2PropertyFormatter().Format(GetContext("name"), hl7DataType);

            AssertXml("result", "<name nullFlavor=\"NI\"/>", result);
        }
Ejemplo n.º 5
0
        public virtual void TestCustomUnit()
        {
            Interval <PlatformDate> interval = IntervalFactory.CreateWidth <PlatformDate>(new DateDiff(1, IvlTsR2PropertyFormatterTest.CustomUnit
                                                                                                       .SANDWICH));
            DateInterval dateInterval = new DateInterval(interval);
            IVL_TSImpl   hl7DataType  = new IVL_TSImpl(dateInterval);

            hl7DataType.DataType = StandardDataType.IVL_TS;
            string result = new IvlTsR2PropertyFormatter().Format(GetContext("name"), hl7DataType);

            AssertXml("result", "<name><width unit=\"SANDWICH\" value=\"1\"/></name>", result);
        }
Ejemplo n.º 6
0
        public virtual void TestNullable()
        {
            Interval <PlatformDate> interval = IntervalFactory.CreateWidth <PlatformDate>(new DateDiff(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor
                                                                                                       .OTHER));
            DateInterval dateInterval = new DateInterval(interval);
            IVL_TSImpl   hl7DataType  = new IVL_TSImpl(dateInterval);

            hl7DataType.DataType = StandardDataType.IVL_TS;
            string result = new IvlTsR2PropertyFormatter().Format(GetContext("name"), hl7DataType);

            AssertXml("result", "<name><width nullFlavor=\"OTH\"/></name>", result);
        }
Ejemplo n.º 7
0
        private void AppendValidTime(StringBuilder buffer, EntityName value, FormatContext context, int indentLevel)
        {
            Interval <PlatformDate> validTime = value.ValidTime;

            if (validTime != null)
            {
                FormatContext ivlTsContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("IVL<TS>", "validTime"
                                                                                                                       , context);
                IVL_TSImpl ivlImpl            = new IVL_TSImpl(new DateInterval(validTime));
                string     formattedValidTime = this.validTimeFormatter.Format(ivlTsContext, ivlImpl, indentLevel);
                buffer.Append(formattedValidTime);
            }
        }
Ejemplo n.º 8
0
 private void HandleValidTime(CodedTypeR2 <Code> codedType, int indentLevel, StringBuilder result, FormatContext context)
 {
     if (HasValidTime(codedType))
     {
         if (ValidTimeAllowed())
         {
             FormatContext newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("IVL<TS>", "validTime"
                                                                                                                  , context);
             Interval <PlatformDate> validTime = codedType.ValidTime;
             IVL_TS ivlTs = new IVL_TSImpl(validTime == null ? null : new DateInterval(validTime));
             string formattedValidTime = this.ivlFormatter.Format(newContext, ivlTs, indentLevel);
             result.Append(formattedValidTime);
         }
     }
 }
Ejemplo n.º 9
0
        public virtual void TestBasic()
        {
            TimeZoneInfo            timeZone = TimeZoneUtil.GetTimeZone("America/Toronto");
            Interval <PlatformDate> interval = IntervalFactory.CreateLowHigh <PlatformDate>(DateUtil.GetDate(2006, 11, 25, 11, 12, 13,
                                                                                                             0, timeZone), DateUtil.GetDate(2007, 0, 2, 10, 11, 12, 0, timeZone));
            DateInterval dateInterval = new DateInterval(interval);
            IVL_TSImpl   hl7DataType  = new IVL_TSImpl(dateInterval);

            hl7DataType.DataType = StandardDataType.IVL_TS;
            string result = new IvlTsR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                      (this.result, null, "name", "IVL<TS>", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.POPULATED, null, false, SpecificationVersion
                                                                      .V02R02, timeZone, timeZone, null, false), hl7DataType);

            Assert.IsTrue(this.result.IsValid());
            AssertXml("result", "<name><low value=\"20061225111213.0000-0500\"/><high value=\"20070102101112.0000-0500\"/></name>", result
                      );
        }