Exemple #1
0
        public void R2QSD_INT_ParseTest03()
        {
            // create differentiating continuous set expression
            QSD<INT> set = new QSD<INT>(
                    new IVL<INT>(1, 10)
                    {
                        LowClosed = true,
                        HighClosed = true
                    },
                    new IVL<INT>(5, 8)
                    {
                        LowClosed = true,
                        HighClosed = true
                    }
            );

            // Set Valid Contact Interval
            set.ValidTimeLow = new TS(new DateTime(2008, 01, 01, 00, 00, 00), DatePrecision.Second);
            set.ValidTimeHigh = new TS(new DateTime(2008, 01, 31, 23, 59, 59), DatePrecision.Second);

            set.NullFlavor = null;
            set.UpdateMode = UpdateMode.Add;
            set.OriginalText = "Test";


            // normalize the set expression
            set = set.Normalize() as QSD<INT>;
            var actualXml = R2SerializationHelper.SerializeAsString(set);
            var set2 = R2SerializationHelper.ParseString<QSD<INT>>(actualXml);
            Assert.AreEqual(set, set2);
        }
Exemple #2
0
        public void R2QSD_INT_ParseTest()
        {
            // create differentiating continuous set expression
            QSD<INT> set = new QSD<INT>(
                    new IVL<INT>(1, 10)
                    {
                        LowClosed = true,
                        HighClosed = true
                    },
                    new IVL<INT>(5, 8)
                    {
                        LowClosed = true,
                        HighClosed = true
                    }
            );

            // normalize the set expression
            set = set.Normalize() as QSD<INT>;
            var actualXml = R2SerializationHelper.SerializeAsString(set);
            var set2 = R2SerializationHelper.ParseString<QSD<INT>>(actualXml);

            Assert.AreEqual(set, set2);
        }
Exemple #3
0
        public void R2QSD_INT_MixedTermsTest05()
        {
            // create differentiating continuous set expression
            QSD<INT> set = new QSD<INT>(

                    // minuend
                    new IVL<INT>(1, 10)
                    {
                        LowClosed = true,
                        HighClosed = true
                    },
                    // subtrahend
                    SXPR<INT>.CreateSXPR(
                        new IVL<INT>(4,6) { 
                            Operator = SetOperator.Intersect,
                            LowClosed = true,
                            HighClosed = true
                        },
                        new IVL<INT>(9, 10)
                        {
                            Operator = SetOperator.Intersect,
                            LowClosed = true,
                            HighClosed = true
                        }
                    )
            );

            // normalize the set expression
            set = set.Normalize() as QSD<INT>;
            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><minuend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1""/><high value=""10""/></minuend><subtrahend xsi:type=""IVL_INT""><term xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""4""/><high value=""6""/></term><term xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""9""/><high value=""10""/></term></subtrahend></test>";

            //Assert.IsTrue(set.Validate());
            var actualXml = R2SerializationHelper.SerializeAsString(set);
            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
Exemple #4
0
        public void R2QSD_INT_SerializationTest04()
        {
            // create differentiating continuous set expression
            QSD<INT> set = new QSD<INT>(
                    new IVL<INT>(1, 10)
                    {
                        LowClosed = true,
                        HighClosed = true
                    },
                    new IVL<INT>(5, 8)
                    {
                        LowClosed = true,
                        HighClosed = true
                    }
            );

            // Set Valid Contact Interval
            set.ValidTimeLow = new TS(new DateTime(2008, 01, 01, 00, 00, 00), DatePrecision.Second);
            set.ValidTimeHigh = new TS(new DateTime(2008, 01, 31, 23, 59, 59), DatePrecision.Second);

            set.NullFlavor = null;
            set.UpdateMode = UpdateMode.Add;
            set.OriginalText = "Test";

            // normalize the set expression
            set = set.Normalize() as QSD<INT>;
            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" validTimeLow=""20080101000000-0500"" validTimeHigh=""20080131235959-0500"" updateMode=""A""><originalText language=""en-US"" value=""Test""/><minuend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1""/><high value=""10""/></minuend><subtrahend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""5""/><high value=""8""/></subtrahend></test>";

            //Assert.IsTrue(set.Validate());
            var actualXml = R2SerializationHelper.SerializeAsString(set);
            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
Exemple #5
0
        public void R2QSD_INT_SerializationTest02()
        {
            // create differentiating continuous set expression
            QSD<INT> set = new QSD<INT>(
                    new IVL<INT>(1, 10)
                    {
                        LowClosed = true,
                        HighClosed = true
                    },
                    new IVL<INT>(5, 8)
                    {
                        LowClosed = true,
                        HighClosed = true
                    }
            );

            // nullifiy the QSD instance
            set.NullFlavor = NullFlavor.NoInformation;

            // normalize the set expression
            set = set.Normalize() as QSD<INT>;
            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><minuend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1""/><high value=""10""/></minuend><subtrahend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""5""/><high value=""8""/></subtrahend></test>";

            Assert.IsFalse(set.Validate());
            var actualXml = R2SerializationHelper.SerializeAsString(set);

            // Assert:  make sure that an exception is thrown
            try
            {
                R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Assert.IsTrue(e.ToString().Contains("Exception"));
            }
        }
Exemple #6
0
        public void R2QSD_INT_SerializationTest()
        {
            // create differentiating continuous set expression
            QSD<INT>  set = new QSD<INT>(
                    new IVL<INT>(1, 10)
                    {
                        LowClosed = true,
                        HighClosed = true
                    },
                    new IVL<INT>(5, 8)
                    {
                        LowClosed = true,
                        HighClosed = true
                    }
            );

            // normalize the set expression
            set = set.Normalize() as QSD<INT>;
            var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><minuend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1""/><high value=""10""/></minuend><subtrahend xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""5""/><high value=""8""/></subtrahend></test>";

            Assert.IsTrue(set.Validate());
            var actualXml = R2SerializationHelper.SerializeAsString(set);
            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }