public virtual void ShouldParseValidInformationForSk() { XmlNode node = CreateNode("<effectiveTime>" + " <comp operator=\"I\">" + " <low specializationType=\"TS.FULLDATE\" value=\"20050803\"/>" + " <width specializationType=\"TS.FULLDATE\" value=\"3\" unit=\"wk\"/>" + " </comp>" + " <comp>" + " <frequency>" + " <numerator specializationType=\"INT.NONNEG\" value=\"3\"/>" + " <denominator>" + " <low unit=\"d\" value=\"3\"/>" + " <high unit=\"d\" value=\"10\"/>" + " </denominator>" + " </frequency>" + " </comp>" + "</effectiveTime>" ); ParseContext context = ParseContextImpl.Create("GTS.BOUNDEDPIVL", typeof(GeneralTimingSpecification), SpecificationVersion .V01R04_2_SK, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, null, false); GeneralTimingSpecification result = (GeneralTimingSpecification) new GtsBoundedPivlElementParser().Parse(context, node, this .xmlResult).BareValue; Assert.IsNotNull(result, "result"); Assert.AreEqual(new BigDecimal("3"), ((DateDiff)result.Duration.Width).ValueAsPhysicalQuantity.Quantity, "interval width value" ); Assert.AreEqual("wk", ((DateDiff)result.Duration.Width).Unit.CodeValue, "interval width unit"); Assert.IsTrue(result.Frequency is PeriodicIntervalTimeSk, "frequency is for SK"); Assert.AreEqual(3, result.Frequency.Repetitions, "frequency times"); Assert.AreEqual(new BigDecimal("3"), ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.Low.Quantity, "low frequency period value" ); Assert.AreEqual("d", ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.Low.Unit.CodeValue, "low frequency period unit" ); Assert.AreEqual(new BigDecimal("10"), ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.High.Quantity, "high frequency period value" ); Assert.AreEqual("d", ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.High.Unit.CodeValue, "high frequency period unit" ); }
public virtual void TestBasicPhase() { GeneralTimingSpecification gts = new GeneralTimingSpecification(IntervalFactory.CreateLowHigh <PlatformDate>(DateUtil.GetDate (1969, 11, 31), DateUtil.GetDate(1969, 11, 31)), PeriodicIntervalTime.CreatePhase(IntervalFactory.CreateLowHigh <PlatformDate >(DateUtil.GetDate(1969, 11, 31), DateUtil.GetDate(1969, 11, 31)))); string result = new GtsBoundedPivlFormatter().Format(GetContext("name"), new GTSImpl(gts)); AssertXml("result", "<name specializationType=\"GTS.BOUNDEDPIVL\" xsi:type=\"SXPR_TS\">" + "<comp specializationType=\"IVL_TS.FULLDATE\" xsi:type=\"IVL_TS\">" + "<low value=\"19691231\"/>" + "<high value=\"19691231\"/></comp>" + "<comp operator=\"I\" specializationType=\"PIVL_TS.DATETIME\" xsi:type=\"PIVL_TS\">" + "<phase><low value=\"19691231\"/><high value=\"19691231\"/></phase></comp></name>", result); Assert.IsTrue(this.result.IsValid()); }
public virtual void TestBasicFreq() { GeneralTimingSpecification gts = new GeneralTimingSpecification(IntervalFactory.CreateLowWidth <PlatformDate>(DateUtil.GetDate (1969, 11, 31), new DateDiff(CreateQuantity("3", Ca.Infoway.Messagebuilder.Domainvalue.Basic.DefaultTimeUnit.DAY))), PeriodicIntervalTime .CreateFrequency(3, CreateQuantity("3", Ca.Infoway.Messagebuilder.Domainvalue.Basic.DefaultTimeUnit.DAY))); string result = new GtsBoundedPivlFormatter().Format(GetContext("name"), new GTSImpl(gts)); AssertXml("result", "<name specializationType=\"GTS.BOUNDEDPIVL\" xsi:type=\"SXPR_TS\">" + "<comp specializationType=\"IVL_TS.FULLDATE\" xsi:type=\"IVL_TS\">" + "<low value=\"19691231\"/>" + "<width unit=\"d\" value=\"3\"/></comp>" + "<comp operator=\"I\" specializationType=\"PIVL_TS.DATETIME\" xsi:type=\"PIVL_TS\">" + "<frequency><numerator specializationType=\"INT.NONNEG\" value=\"3\" xsi:type=\"INT\"/>" + "<denominator specializationType=\"PQ.TIME\" unit=\"d\" value=\"3\" xsi:type=\"PQ\"/>" + "</frequency></comp></name>", result); Assert.IsTrue(this.result.IsValid()); }
public virtual void TestBasicAsCeRx() { GeneralTimingSpecification gts = new GeneralTimingSpecification(IntervalFactory.CreateLowHigh <PlatformDate>(DateUtil.GetDate (1969, 11, 31), DateUtil.GetDate(1969, 11, 31)), PeriodicIntervalTime.CreatePeriod(new DateDiff(CreateQuantity("3", Ca.Infoway.Messagebuilder.Domainvalue.Basic.DefaultTimeUnit .DAY)))); string result = new GtsBoundedPivlFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "GTS.BOUNDEDPIVL", null, null, false, SpecificationVersion.V01R04_3, null, null, null, false ), new GTSImpl(gts)); AssertXml("result", "<name xsi:type=\"SXPR_TS\">" + "<comp operator=\"I\" xsi:type=\"IVL_TS\">" + "<low value=\"19691231\"/>" + "<high value=\"19691231\"/>" + "</comp>" + "<comp xsi:type=\"PIVL_TS\">" + "<period unit=\"d\" value=\"3\"/>" + "</comp>" + "</name>", result); Assert.IsTrue(this.result.IsValid()); }
public virtual void TimeZoneHandling() { GeneralTimingSpecification gts = new GeneralTimingSpecification(IntervalFactory.CreateLowHigh <PlatformDate>(DateUtil.GetDate (1969, 11, 31), DateUtil.GetDate(1969, 11, 31)), PeriodicIntervalTime.CreateFrequency(2, new PhysicalQuantity(BigDecimal .TEN, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.DAY))); string result = new GtsBoundedPivlFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "GTS.BOUNDEDPIVL", null, null, false, SpecificationVersion.V01R04_3, TimeZoneUtil.GetTimeZone ("GMT-7"), null, null, false), new GTSImpl(gts)); AssertXml("result", "<name xsi:type=\"SXPR_TS\">" + "<comp operator=\"I\" xsi:type=\"IVL_TS\">" + "<low value=\"19691230\"/>" + "<high value=\"19691230\"/></comp>" + "<comp xsi:type=\"PIVL_TS\">" + "<frequency><numerator value=\"2\"/><denominator unit=\"d\" value=\"10\"/></frequency></comp></name>" , result); Assert.IsTrue(this.result.IsValid()); }
public virtual void TestBasicPhaseAsMR2009() { GeneralTimingSpecification gts = new GeneralTimingSpecification(IntervalFactory.CreateLowHigh <PlatformDate>(DateUtil.GetDate (1969, 11, 31), DateUtil.GetDate(1969, 11, 31)), PeriodicIntervalTime.CreatePhase(IntervalFactory.CreateLowHigh <PlatformDate >(DateUtil.GetDate(1969, 11, 31), DateUtil.GetDate(1969, 11, 31)))); string result = new GtsBoundedPivlFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "GTS.BOUNDEDPIVL", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false ), new GTSImpl(gts)); AssertXml("result", "<name specializationType=\"GTS.BOUNDEDPIVL\" xsi:type=\"SXPR_TS\">" + "<comp specializationType=\"IVL_TS.FULLDATE\" xsi:type=\"IVL_TS\">" + "<low value=\"19691231\"/>" + "<high value=\"19691231\"/></comp>" + "<comp operator=\"I\" specializationType=\"PIVL_TS.DATETIME\" xsi:type=\"PIVL_TS\">" + "<phase><low value=\"19691231\"/><high value=\"19691231\"/></phase></comp></name>", result); Assert.IsTrue(this.result.IsValid()); }
public virtual void ShouldParseValidInformationWhenMissingInnerSpecializationTypes() { XmlNode node = CreateNode("<effectiveTime specializationType=\"GTS.BOUNDEDPIVL\">" + " <comp operator=\"I\">" + " <low value=\"20050803\"/>" + " <width value=\"3\" unit=\"wk\"/>" + " </comp>" + " <comp>" + " <frequency>" + " <numerator value=\"3\"/>" + " <denominator value=\"1\" unit=\"d\"/>" + " </frequency>" + " </comp>" + "</effectiveTime>"); ParseContext context = ParseContextImpl.Create("GTS.BOUNDEDPIVL", typeof(GeneralTimingSpecification), SpecificationVersion .V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, null, false); GeneralTimingSpecification result = (GeneralTimingSpecification) new GtsBoundedPivlElementParser().Parse(context, node, this .xmlResult).BareValue; Assert.IsNotNull(result, "result"); Assert.AreEqual(new BigDecimal("3"), ((DateDiff)result.Duration.Width).ValueAsPhysicalQuantity.Quantity, "interval width value" ); Assert.AreEqual("wk", ((DateDiff)result.Duration.Width).Unit.CodeValue, "interval width unit"); Assert.AreEqual(3, result.Frequency.Repetitions, "frequency times"); Assert.AreEqual(new BigDecimal("1"), result.Frequency.Quantity.Quantity, "frequency period value"); Assert.AreEqual("d", result.Frequency.Quantity.Unit.CodeValue, "frequency period unit"); }