public void R2QSPParseTest03() { QSP<INT> set = new QSP<INT>( new IVL<INT>(1, 5) { LowClosed = true, HighClosed = true }, new IVL<INT>(6, 10) { LowClosed = true, HighClosed = true } ); // Nullifiy properties set.NullFlavor = null; set.ValidTimeLow = new TS((new DateTime(2008, 01, 01)), DatePrecision.Day); set.ValidTimeHigh = new TS((new DateTime(2008, 01, 31)), DatePrecision.Day); set.UpdateMode = UpdateMode.Add; // normalize the set expression set = set.Normalize() as QSP<INT>; var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" updateMode=""A"" validTimeLow=""20080101"" validTimeHigh=""20080131""><low xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1""/><high value=""5""/></low><high xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""6""/><high value=""10""/></high></test>"; Assert.IsTrue(set.Validate()); var actualXml = R2SerializationHelper.SerializeAsString(set); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void R2QSPParseTest02() { QSP<INT> set = new QSP<INT>( new IVL<INT>(1, 5) { LowClosed = true, HighClosed = true }, new IVL<INT>(6, 10) { LowClosed = true, HighClosed = true } ); // Nullifiy properties set.NullFlavor = null; set.ValidTimeHigh = null; set.ValidTimeLow = null; set.UpdateMode = null; // normalize the set expression set = set.Normalize() as QSP<INT>; // normalize the set expression set = set.Normalize() as QSP<INT>; var actualXml = R2SerializationHelper.SerializeAsString(set); var set2 = R2SerializationHelper.ParseString<QSP<INT>>(actualXml); Assert.AreEqual(set, set2); }
public void R2QSPSerializationTest() { QSP<INT> set = new QSP<INT>( new IVL<INT>(1, 5) { LowClosed = true, HighClosed = true }, new IVL<INT>(6, 10) { LowClosed = true, HighClosed = true } ); // normalize the set expression set = set.Normalize() as QSP<INT>; var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><low xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1"" /><high value=""5"" /></low><high xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""6""/><high value=""10""/></high></test>"; Assert.IsTrue(set.Validate()); var actualXml = R2SerializationHelper.SerializeAsString(set); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void R2QSPParseTest() { QSP<INT> set = new QSP<INT>( new IVL<INT>(1, 5) { LowClosed = true, HighClosed = true }, new IVL<INT>(6, 10) { LowClosed = true, HighClosed = true } ); // normalize the set expression set = set.Normalize() as QSP<INT>; var actualXml = R2SerializationHelper.SerializeAsString(set); var set2 = R2SerializationHelper.ParseString<QSP<INT>>(actualXml); Assert.AreEqual(set, set2); }
public void R2QSPMixedTermsSerializationTest() { QSP<INT> set = new QSP<INT>( // This set will result in an interval of 1..10, // and is also the Low part of the overall Periodic Hull SXPR<INT>.CreateSXPR( new IVL<INT>(1, 5) { LowClosed = true, HighClosed = true, Operator = SetOperator.PeriodicHull }, new IVL<INT>(6, 10) { LowClosed = true, HighClosed = true, Operator = SetOperator.PeriodicHull } ), // This interval is the High part of the overall Periodic Hull new IVL<INT>(8, 12) { LowClosed = true, HighClosed = true } ); // resulting interval will be 1..12 // normalize the set expression set = set.Normalize() as QSP<INT>; var expectedXml = @"<test xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""urn:hl7-org:v3""><low xsi:type=""QSP_INT""><low xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""1"" /><high value=""5"" /></low><high xsi:type=""IVL_INT"" lowClosed=""true"" highClosed=""true""><low value=""6"" /><high value=""10"" /></high></low><high xsi:type=""QSP_INT"" lowClosed=""true"" highClosed=""true""><low value=""8""/><high value=""12""/></high></test>"; Assert.IsTrue(set.Validate()); var actualXml = R2SerializationHelper.SerializeAsString(set); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }