Exemplo n.º 1
0
        public void EIVLSerializationTest03()
        {
            // construct eivl
            EIVL <TS> eivl = new EIVL <TS>(
                DomainTimingEventType.Breakfast,
                new IVL <PQ>(
                    new PQ(-1, "h"),   // low
                    new PQ(-50, "min") // high
                    )
                );

            eivl.Offset.HighClosed = true;
            eivl.Offset.LowClosed  = true;
            eivl.ValidTimeLow      = new TS(new DateTime(2012, 01, 01), DatePrecision.Day);
            eivl.ValidTimeHigh     = new TS(new DateTime(2012, 12, 31), DatePrecision.Day);
            eivl.NullFlavor        = null;
            eivl.UpdateMode        = UpdateMode.Add;
            eivl.OriginalText      = "One hour before breakfast for 10 minutes";

            Assert.IsTrue(eivl.Validate());

            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" event=""CM"" validTimeHigh=""20121231"" validTimeLow=""20120101"" updateMode=""A"" ><originalText value=""One hour before breakfast for 10 minutes"" language=""en-US"" /><offset lowClosed=""true"" highClosed=""true""><low value=""-1"" unit=""h""/><high value=""-50"" unit=""min""/></offset></test>";
            var actualXml   = R2SerializationHelper.SerializeAsString(eivl);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
Exemplo n.º 2
0
        public void EIVLSerializationTest01()
        {
            // construct eivl
            EIVL <TS> eivl = new EIVL <TS>(
                DomainTimingEventType.Dinner,
                new IVL <PQ>(
                    new PQ(30, "min"), // low
                    new PQ(30, "min")  // high
                    )
                );

            eivl.Offset.HighClosed = true;
            eivl.Offset.LowClosed  = true;
            eivl.ValidTimeHigh     = null;
            eivl.ValidTimeLow      = null;
            eivl.ControlActRoot    = null;
            eivl.ControlActExt     = null;
            eivl.NullFlavor        = null;
            eivl.UpdateMode        = null;
            eivl.OriginalText      = null;

            Assert.IsTrue(eivl.Validate());

            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" event=""CV"" ><offset lowClosed=""true"" highClosed=""true""><low value=""30"" unit=""min""/><high value=""30"" unit=""min""/></offset></test>";
            var actualXml   = R2SerializationHelper.SerializeAsString(eivl);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
Exemplo n.º 3
0
        public void ConstructingEIVLTest01()
        {
            // An hour after meal
            EIVL <TS> hourAfterMeal = new EIVL <TS>(
                DomainTimingEventType.Meal,
                new IVL <PQ>(new PQ(1, "h"))
                );

            EIVL <TS> eivl1 = new EIVL <TS>(
                DomainTimingEventType.Meal,
                new IVL <PQ>(
                    new PQ(1, "h")  // high
                    )
                );

            // 1-2 hours before sleep
            EIVL <TS> beforeSleep = new EIVL <TS>(
                DomainTimingEventType.HourOfSleep,
                new IVL <PQ>(new PQ(-2, "h"), new PQ(-1, "h"))
                );

            // Construct instructions as a union of the two
            GTS instructionTime = new GTS();

            instructionTime.Hull = QSU <TS> .CreateQSU(
                hourAfterMeal,
                beforeSleep
                );

            Assert.IsTrue(eivl1.Validate());

            Assert.IsTrue(hourAfterMeal.Validate());
            Assert.IsTrue(beforeSleep.Validate());
            Assert.IsTrue(instructionTime.Validate());
        }
Exemplo n.º 4
0
 public void GTSTestXsiOutputEIVL_TS_Test()
 {
     // Constrct a GTS
     GTS test = new EIVL<TS>(DomainTimingEventType.AfterBreakfast, null);
     String xml = R1SerializationHelper.SerializeAsString(test, Formatters.XML.Datatypes.R1.DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture);
     Assert.IsTrue(xml.Contains("xsi:type=\"EIVL_TS\""));
 }
Exemplo n.º 5
0
        public void GTSTestXsiOutputEIVL_TS_Test()
        {
            // Constrct a GTS
            GTS    test = new EIVL <TS>(DomainTimingEventType.AfterBreakfast, null);
            String xml  = R1SerializationHelper.SerializeAsString(test, Formatters.XML.Datatypes.R1.DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture);

            Assert.IsTrue(xml.Contains("xsi:type=\"EIVL_TS\""));
        }
Exemplo n.º 6
0
 public override void Dispose()
 {
     if (!base._isDisposed)
     {
         _value = null;
         GC.SuppressFinalize(this);
         base._isDisposed = !base._isDisposed;
     }
 }
Exemplo n.º 7
0
        public void ConstructingEIVLTest02()
        {
            // An hour after meal
            EIVL <TS> hourAfterMeal = new EIVL <TS>(
                new DomainTimingEventType(),    // eventType
                new IVL <PQ>()                  // offset
                );

            hourAfterMeal.NullFlavor = NullFlavor.Other;
            Assert.IsFalse(hourAfterMeal.Validate());
        }
Exemplo n.º 8
0
        public virtual void TestParseNullNode()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NI\" />");
            EIVL <EventRelatedPeriodicIntervalTime> tel = (EIVL <EventRelatedPeriodicIntervalTime>) new EivlTsR2ElementParser().Parse(CreateContext
                                                                                                                                          ("EIVL<TS>", SpecificationVersion.V02R02), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNull(tel.Value, "null returned");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, tel.NullFlavor, "null flavor"
                            );
        }
Exemplo n.º 9
0
        public void EIVLValidEIVL()
        {
            // Offset of 1d
            IVL <PQ> effectiveTime = new IVL <PQ>()
            {
                High = new PQ(1, "d")
            };
            // Event is BeforeLunch
            CS <DomainTimingEventType> event1 = new CS <DomainTimingEventType>(DomainTimingEventType.BeforeLunch);

            // Create EIVL instance and pass it the effective Time and event
            EIVL <TS> eivlInstance = new EIVL <TS>();

            //eivlInstance.Offset = effectiveTime;
            eivlInstance.Event = event1;

            // true if it validates
            Assert.IsTrue(eivlInstance.Validate());
        }
Exemplo n.º 10
0
        public void EIVLSerializationTest01()
        {
            // construct eivl
            EIVL<TS> eivl = new EIVL<TS>(
                DomainTimingEventType.Dinner,
                new IVL<PQ>(
                    new PQ(30, "min"),  // low
                    new PQ(30, "min")  // high
                )
                );
            eivl.Offset.HighClosed = true;
            eivl.Offset.LowClosed = true;
            eivl.ValidTimeHigh = null;
            eivl.ValidTimeLow = null;
            eivl.ControlActRoot = null;
            eivl.ControlActExt = null;
            eivl.NullFlavor = null;
            eivl.UpdateMode = null;
            eivl.OriginalText = null;

            Assert.IsTrue(eivl.Validate());

            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" event=""CV"" ><offset lowClosed=""true"" highClosed=""true""><low value=""30"" unit=""min""/><high value=""30"" unit=""min""/></offset></test>";
            var actualXml = R2SerializationHelper.SerializeAsString(eivl);
            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
Exemplo n.º 11
0
        public void EIVLSerializationTest03()
        {
            // construct eivl
            EIVL<TS> eivl = new EIVL<TS>(
                DomainTimingEventType.Breakfast,
                new IVL<PQ>(
                    new PQ(-1, "h"),  // low
                    new PQ(-50, "min")  // high
                )
                );
            eivl.Offset.HighClosed = true;
            eivl.Offset.LowClosed = true;
            eivl.ValidTimeLow = new TS(new DateTime(2012, 01, 01), DatePrecision.Day);
            eivl.ValidTimeHigh = new TS(new DateTime(2012, 12, 31), DatePrecision.Day);
            eivl.NullFlavor = null;
            eivl.UpdateMode = UpdateMode.Add;
            eivl.OriginalText = "One hour before breakfast for 10 minutes";

            Assert.IsTrue(eivl.Validate());

            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" event=""CM"" validTimeHigh=""20121231"" validTimeLow=""20120101"" updateMode=""A"" ><originalText value=""One hour before breakfast for 10 minutes"" language=""en-US"" /><offset lowClosed=""true"" highClosed=""true""><low value=""-1"" unit=""h""/><high value=""-50"" unit=""min""/></offset></test>";
            var actualXml = R2SerializationHelper.SerializeAsString(eivl);
            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
Exemplo n.º 12
0
        public void EIVLValidEIVL()
        {
            // Offset of 1d
            IVL<PQ> effectiveTime = new IVL<PQ>() { High = new PQ(1, "d") };
            // Event is BeforeLunch
            CS<DomainTimingEventType> event1 = new CS<DomainTimingEventType>(DomainTimingEventType.BeforeLunch);
            
            // Create EIVL instance and pass it the effective Time and event 
            EIVL<TS> eivlInstance = new EIVL<TS>();
            //eivlInstance.Offset = effectiveTime;
            eivlInstance.Event = event1;

            // true if it validates
            Assert.IsTrue(eivlInstance.Validate());
        }
Exemplo n.º 13
0
        public void ConstructingEIVLTest01()
        {
            // An hour after meal
            EIVL<TS> hourAfterMeal = new EIVL<TS>(
                DomainTimingEventType.Meal,
                new IVL<PQ>(new PQ(1, "h"))
                );

            EIVL<TS> eivl1 = new EIVL<TS>(
                DomainTimingEventType.Meal,
                new IVL<PQ>(
                    new PQ(1, "h")  // high
                )
                );

            // 1-2 hours before sleep
            EIVL<TS> beforeSleep = new EIVL<TS>(
                DomainTimingEventType.HourOfSleep,
                new IVL<PQ>( new PQ(-2, "h"), new PQ(-1, "h") )
                );

            // Construct instructions as a union of the two
            GTS instructionTime = new GTS();
            instructionTime.Hull = QSU<TS>.CreateQSU(
                hourAfterMeal,
                beforeSleep
                );

            Assert.IsTrue(eivl1.Validate());

            Assert.IsTrue(hourAfterMeal.Validate());
            Assert.IsTrue(beforeSleep.Validate());
            Assert.IsTrue(instructionTime.Validate());
        }
Exemplo n.º 14
0
        public void ConstructingEIVLTest02()
        {
            // An hour after meal
            EIVL<TS> hourAfterMeal = new EIVL<TS>(
                new DomainTimingEventType(),    // eventType
                new IVL<PQ>()                   // offset
                );

            hourAfterMeal.NullFlavor = NullFlavor.Other;
            Assert.IsFalse(hourAfterMeal.Validate());
        }
Exemplo n.º 15
0
        public IEIVLBuilder Clear()
        {
            _value = base.ResetValue <EIVL>();

            return(this);
        }